-->

Wednesday, September 28, 2022

[Solved] Persistentvolume claim pending while installing the Elasticsearch using Helm

 


Issue:- 

When installing the elasticsearch using the helm , the elasticsearch continaer fails as the multimaster nodes go in pending state for the persistentvolumeclaim and continaer remains in the pending state.

Error:- 


Persistent volume claim remains in the pending state

Effect:-

Was not able to install the elasticsearch as persistent volume claim was not ready for the  Elasticsearch.

Resolution:-
Follow the following steps to resolve the issue

1. First create a 3 Persistent Volume using the configuration below i.e. pv.yaml

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

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

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

2. Than create the 3 Persistent Volume claim which can be used by the Elasticsearch pod i.e. pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: elasticsearch-master-elasticsearch-master-0
spec:
  storageClassName: standard
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

---

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

---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: elasticsearch-master-elasticsearch-master-2
spec:
  storageClassName: standard
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

Explanation:-

Here elasticsearch creates a 3 node cluster which can be overwritten by specifying the replicas you want and passing the yaml file with the helm. But by default its 3 so if you create a single persistent volume than remaining 2 persistent volume claim will remain in the pending state so its important that you create 3 persistent volumes which can be used the 3 persistent volumes claims and inturn by the elasticsearch pod.

0 comments:

Post a Comment