2

我正在将 ElasticSearch 迁移到 Kubernetes 的 PetSet,但在配置 PersistentVolumeClaim 时出现问题。

我在 AWS “vol-84094e30” “vol-87e59f33” 中有两卷。两者都是 5 GiB、100/3000 IOPS、us-west-2a 可用区并且是卷类型 gp2。

我有一个卷类型的 StorageClass 定义:

{
  "kind": "StorageClass",
  "apiVersion": "apps/v1alpha1",
  "metadata": {
    "name": "fast"
  },
  "provisioner": "kubernetes.io/aws-ebs",
  "parameters": {
    "type": "gp2",
    "zone": "us-west-2a"
  }
}

… 两个 PersistentVolume 定义:

{
  "kind": "PersistentVolume",
  "apiVersion": "v1",
  "metadata": {
    "name": "es-persistent-vol",
    "labels": {
      "type": "amazonEBS"
    }
  },
  "spec": {
    "capacity": {
      "storage": "5Gi"
    },
    "accessModes": [
      "ReadWriteOnce"
    ],
   "awsElasticBlockStore": {
      "volumeID": "vol-87e59f33",
      "fsType": "ext4"
    }
  }
}


{
  "kind": "PersistentVolume",
  "apiVersion": "v1",
  "metadata": {
    "name": "es-persistent-vol2",
    "labels": {
      "type": "amazonEBS"
    }
  },
  "spec": {
    "capacity": {
      "storage": "5Gi"
    },
    "accessModes": [
      "ReadWriteOnce"
    ],
    "awsElasticBlockStore": {
      "volumeID": "vol-84094e30",
      "fsType": "ext4"
    }
  }
}

… 弹性搜索服务:

{
  "apiVersion": "v1",
  "kind": "Service",
  "metadata": {
    "name": "elasticsearch-logging",
    "namespace": "kube-system",
    "labels": {
      "k8s-app": "elasticsearch-logging",
      "kubernetes.io/name": "Elasticsearch"
    }
  },
  "spec": {
    "ports": [
      {
        "port": 9200,
        "protocol": "TCP",
        "targetPort": "db"
      }
    ],
    "selector": {
      "k8s-app": "elasticsearch-logging"
    }
  }
}

… 和一个 Elastic Search PetSet:

{
  "apiVersion": "apps/v1alpha1",
  "kind": "PetSet",
  "metadata": {
    "name": "elasticsearch-logging-v1",
    "namespace": "kube-system",
    "labels": {
      "k8s-app": "elasticsearch-logging",
      "version": "v1",
      "kubernetes.io/cluster-service": "true"
    }
  },
  "spec": {
    "serviceName": "elasticsearch-logging-v1",
    "replicas": 2,
    "template": {
      "metadata": {
        "annotations": {
          "pod.beta.kubernetes.io/initialized": "true"
        },
        "labels": {
          "app": "elasticsearch-data"
        }
      },
      "spec": {
        "containers": [
          {
            "image": "gcr.io/google_containers/elasticsearch:v2.4.1",
            "name": "elasticsearch-logging",
            "resources": {
              "limits": {
                "cpu": "1000m"
              },
              "requests": {
                "cpu": "100m"
              }
            },
            "ports": [
              {
                "containerPort": 9200,
                "name": "db",
                "protocol": "TCP"
              },
              {
                "containerPort": 9300,
                "name": "transport",
                "protocol": "TCP"
              }
            ],
            "volumeMounts": [
              {
                "name": "es-persistent-storage",
                "mountPath": "/data"
              }
            ]
          }
        ]
      }
    },
    "volumeClaimTemplates": [
      {
        "metadata": {
          "name": "es-persistent-storage",
          "annotations": {
            "volume.beta.kubernetes.io/storage-class": "fast"
          },
          "labels": {
            "type": "amazonEBS"
          }
        },
        "spec": {
          "accessModes": [
            "ReadWriteOnce"
          ],
          "resources": {
            "requests": {
              "storage": "5Gi"
            }
          }
        }
      }
    ]
  }
}

当我创建所有这些时,PersistentStorageVolume(在 PetSet 中定义)无法配置卷(ProvisioningFailed - 没有匹配的卷插件)。我认为这可能是 AWS 特定的,我在各种论坛上查看过(我认为是)同样的问题,但不适用于 AWS。

任何帮助深表感谢。

以下是 kubectl describe 输出:

$ kubectl describe pv
Name:           es-persistent-vol
Labels:         type=amazonEBS
Status:         Available
Claim:          
Reclaim Policy: Retain
Access Modes:   RWO
Capacity:       5Gi
Message:        
Source:
    Type:       AWSElasticBlockStore (a Persistent Disk resource in AWS)
    VolumeID:   vol-87e59f33
    FSType:     ext4
    Partition:  0
    ReadOnly:   false
No events.

Name:           es-persistent-vol2
Labels:         type=amazonEBS
Status:         Available
Claim:          
Reclaim Policy: Retain
Access Modes:   RWO
Capacity:       5Gi
Message:        
Source:
    Type:       AWSElasticBlockStore (a Persistent Disk resource in AWS)
    VolumeID:   vol-84094e30
    FSType:     ext4
    Partition:  0
    ReadOnly:   false
No events.   


$ kubectl describe pvc       
Name:           es-persistent-storage-elasticsearch-logging-v1-0
Namespace:      kube-system
Status:         Pending
Volume:         
Labels:         app=elasticsearch-data
Capacity:       
Access Modes:   
Events:
  FirstSeen     LastSeen        Count   From                            SubobjectPath   Type            Reason                  Message
  ---------     --------        -----   ----                            -------------   --------        ------                  -------
  18s           1s              3       {persistentvolume-controller }                  Warning         ProvisioningFailed      no volume plugin matched


Name:           es-persistent-storage-elasticsearch-logging-v1-1
Namespace:      kube-system
Status:         Pending
Volume:         
Labels:         app=elasticsearch-data
Capacity:       
Access Modes:   
Events:
  FirstSeen     LastSeen        Count   From                            SubobjectPath   Type            Reason                  Message
  ---------     --------        -----   ----                            -------------   --------        ------                  -------
  19s           2s              3       {persistentvolume-controller }                  Warning         ProvisioningFailed      no volume plugin matched


$ kubectl describe petset
Name:                   elasticsearch-logging-v1
Namespace:              kube-system
Image(s):               gcr.io/google_containers/elasticsearch:v2.4.1
Selector:               app=elasticsearch-data
Labels:                 k8s-app=elasticsearch-logging,kubernetes.io/cluster-service=true,version=v1
Replicas:               2 current / 2 desired
Annotations:            <none>
CreationTimestamp:      Wed, 02 Nov 2016 13:06:23 +0000
Pods Status:            0 Running / 1 Waiting / 0 Succeeded / 0 Failed
No volumes.
Events:
  FirstSeen     LastSeen        Count   From            SubobjectPath   Type            Reason                  Message
  ---------     --------        -----   ----            -------------   --------        ------                  -------
  1m            1m              1       {petset }                       Normal          SuccessfulCreate        pvc: es-persistent-storage-elasticsearch-logging-v1-0
  1m            1m              1       {petset }                       Normal          SuccessfulCreate        pet: elasticsearch-logging-v1-0
  1m            1m              1       {petset }                       Normal          SuccessfulCreate        pvc: es-persistent-storage-elasticsearch-logging-v1-1


$ kubectl describe service el
Name:                   elasticsearch-logging
Namespace:              kube-system
Labels:                 k8s-app=elasticsearch-logging
                        kubernetes.io/name=Elasticsearch
Selector:               k8s-app=elasticsearch-logging
Type:                   ClusterIP
IP:                     192.168.157.15
Port:                   <unset> 9200/TCP
Endpoints:              <none>
Session Affinity:       None
No events.
4

0 回答 0