简体   繁体   中英

pod has unbound immediate PersistentVolumeClaims ECK (Elasticsearch on Kubernetes)

I am trying to deploy elastic on kuberneteshttps://www.elastic.co/guide/en/cloud-on-k8s/current/index.html on a local minikube cluster. I have already installed the operator.

When i apply the elasticsearch cluster below, i get the following pod error:

running "VolumeBinding" filter plugin for pod "data-es-es-default-0": pod has unbound immediate PersistentVolumeClaims

volume/claim:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: elasticsearch-data
  labels:
    type: local
spec:
  storageClassName: standard
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"

--

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: elasticsearch-data
spec:
  storageClassName: standard
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi

elastic.yml

apiVersion: elasticsearch.k8s.elastic.co/v1beta1
kind: Elasticsearch
metadata:
  name: data-es
spec:
  version: 7.4.2
  nodeSets:
  - name: default
    count: 2
    volumeClaimTemplates:
    - metadata:
        name: elasticsearch-data
      spec:
        accessModes:
        - ReadWriteOnce
        storageClassName: standard
        resources:
          requests:
            storage: 10Gi
    config:
      node.master: true
      node.data: true
      node.ingest: true
      node.store.allow_mmap: false
      xpack.security.authc.realms:
        native:
          native1: 
            order: 1
---
apiVersion: kibana.k8s.elastic.co/v1beta1
kind: Kibana
metadata:
  name: data-kibana
spec:
  version: 7.4.2
  count: 1
  elasticsearchRef:
    name: data-es

kubectl get pvc

名称 状态 容量 访问模式 存储类别 年龄 elasticsearch-data 绑定 elasticsearch-data 10Gi RWO 标准 8m45s elasticsearch-data-data-es-es-default-0 待定标准 7m40s elasticsearch-data-data-es-es-default-1 待定标准7分39秒

pod has unbound immediate PersistentVolumeClaims

Above error means there is no persistentVolume that can be bound to the PersistentVolumeClaim . By default local-storage does not really create a persistentVolume dynamically.

To use dynamic provisioning mechanism of local-storage storage class you need to configure the local-storage class so that it can provision the persistentVolume . Check this discussion Kubernetes: What is the best practice for create dynamic local volume to auto assign PVs for PVCs? .

Alternatively without using dynamic provisioning mechanism of a storageclass you need to create a persistentVolume using hostPath which can be bound to the PersistentVolumeClaim .But this is not a recommended solution for production usage. Check this guide here .

PersistentVolumeClaim will be automatically created based on volumeClaimTemplates in the elastic yaml. Hence you should not create a PersistentVolumeClaim .

Since nodeSets count is 2 two PersistentVolumeClaim is created. So you need to create two persistentVolume .

apiVersion: v1
kind: PersistentVolume
metadata:
  name: elasticsearch-data1
  labels:
    type: local
spec:
  storageClassName: standard
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"
---

apiVersion: v1
kind: PersistentVolume
metadata:
  name: elasticsearch-data2
  labels:
    type: local
spec:
  storageClassName: standard
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/data"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM