在kubernetes部署elk stack时出现helm volumebinding错误

dwbf0jvd  于 2021-06-15  发布在  ElasticSearch
关注(0)|答案(1)|浏览(473)

我正试图用这个图表在kubernetes集群中部署elk stack和helm。当我发射时 helm install elk-stack stable/elastic-stack 我收到以下消息:

NAME: elk-stack
LAST DEPLOYED: Mon Aug 24 07:30:31 2020
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
The elasticsearch cluster and associated extras have been installed.
Kibana can be accessed:

  * Within your cluster, at the following DNS name at port 9200:

    elk-stack-elastic-stack.default.svc.cluster.local

  * From outside the cluster, run these commands in the same shell:

    export POD_NAME=$(kubectl get pods --namespace default -l "app=elastic-stack,release=elk-stack" -o jsonpath="{.items[0].metadata.name}")
    echo "Visit http://127.0.0.1:5601 to use Kibana"
    kubectl port-forward --namespace default $POD_NAME 5601:5601

但当我跑的时候

kubectl get pods

结果是:

NAME                                              READY   STATUS              RESTARTS   AGE
elk-stack-elasticsearch-client-7fcfc7b858-5f7fw   0/1     Running   0          12m
elk-stack-elasticsearch-client-7fcfc7b858-zdkwd   0/1     Running   1          12m
elk-stack-elasticsearch-data-0                    0/1     Pending   0          12m
elk-stack-elasticsearch-master-0                  0/1     Pending   0          12m
elk-stack-kibana-cb7d9ccbf-msw95                  1/1     Running   0          12m
elk-stack-logstash-0                              0/1     Pending   0          12m

使用 kubectl describe pods 命令,我看到对于ElasticSearchPods,问题是:

Warning  FailedScheduling  6m29s      default-scheduler  running "VolumeBinding" filter plugin for pod "elk-stack-elasticsearch-data-0": pod has unbound immediate PersistentVolumeClaims

对于贮木荚:

Warning  FailedScheduling  7m53s      default-scheduler  running "VolumeBinding" filter plugin for pod "elk-stack-logstash-0": pod has unbound immediate PersistentVolumeClaims

的输出 kubectl get pv,pvc,sc -A :

NAME                                      CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS        CLAIM                           STORAGECLASS   REASON   AGE
persistentvolume/elasticsearch-data       10Gi       RWO            Retain           Bound         default/elasticsearch-data      manual                  16d

NAMESPACE      NAME                                                                STATUS    VOLUME                   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
default        persistentvolumeclaim/claim1                                        Pending                                                      slow           64m
default        persistentvolumeclaim/data-elk-stack-elasticsearch-data-0           Pending                                                                     120m
default        persistentvolumeclaim/data-elk-stack-elasticsearch-master-0         Pending                                                                     120m
default        persistentvolumeclaim/data-elk-stack-logstash-0                     Pending                                                                     120m
default        persistentvolumeclaim/elasticsearch-data                            Bound     elasticsearch-data       10Gi       RWO            manual         16d
default        persistentvolumeclaim/elasticsearch-data-elasticsearch-data-0       Pending                                                                     17d
default        persistentvolumeclaim/elasticsearch-data-elasticsearch-data-1       Pending                                                                     17d
default        persistentvolumeclaim/elasticsearch-data-quickstart-es-default-0    Pending                                                                     16d
default        persistentvolumeclaim/elasticsearch-master-elasticsearch-master-0   Pending                                                                     17d
default        persistentvolumeclaim/elasticsearch-master-elasticsearch-master-1   Pending                                                                     17d
default        persistentvolumeclaim/elasticsearch-master-elasticsearch-master-2   Pending                                                                     16d

NAMESPACE   NAME                                         PROVISIONER            RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
            storageclass.storage.k8s.io/slow (default)   kubernetes.io/gce-pd   Delete          Immediate           false                  66m

存储类 slow 和持久卷声明 claim1 是我的实验。我使用 kubectl create 还有一个yaml文件,其他文件是由helm自动创建的(我想)。
的输出 kubectl get pvc data-elk-stack-elasticsearch-master-0 -o yaml :

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: "2020-08-24T07:30:38Z"
  finalizers:
  - kubernetes.io/pvc-protection
  labels:
    app: elasticsearch
    release: elk-stack
  managedFields:
  - apiVersion: v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:labels:
          .: {}
          f:app: {}
          f:release: {}
      f:spec:
        f:accessModes: {}
        f:resources:
          f:requests:
            .: {}
            f:storage: {}
        f:volumeMode: {}
      f:status:
        f:phase: {}
    manager: kube-controller-manager
    operation: Update
    time: "2020-08-24T07:30:38Z"
  name: data-elk-stack-elasticsearch-master-0
  namespace: default
  resourceVersion: "201123"
  selfLink: /api/v1/namespaces/default/persistentvolumeclaims/data-elk-stack-elasticsearch-master-0
  uid: de58f769-f9a7-41ad-a449-ef16d4b72bc6
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 4Gi
  volumeMode: Filesystem
status:
  phase: Pending

有人能帮我解决这个问题吗?提前谢谢。

7eumitmz

7eumitmz1#

pod挂起的原因低于PVC挂起的原因,因为没有创建相应的pvs。

data-elk-stack-elasticsearch-master-0
data-elk-stack-logstash-0
data-elk-stack-elasticsearch-data-0

既然您已经提到这是为了本地开发,那么您可以使用hostpath volume进行pv。因此,使用下面的示例pv为每个挂起的pvc创建pv。所以你总共要创建3个pv。

apiVersion: v1
kind: PersistentVolume
metadata:
  name: elk-master
  labels:
    type: local
spec:
  capacity:
    storage: 4Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: elk-logstash
  labels:
    type: local
spec:
  capacity:
    storage: 2Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: elk-data
  labels:
    type: local
spec:
  capacity:
    storage: 30Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"

相关问题