<p>I am trying to install Elasticsearch on Kubernetes using bitnami/elasticsearch. I use the following commands:</p>
<pre><code>helm repo add bitnami https://charts.bitnami.com/bitnami
kubectl apply -f ./es-pv.yaml
helm install elasticsearch --set name=elasticsearch,master.replicas=3,data.persistence.size=6Gi,data.replicas=2,coordinating.replicas=1 bitnami/elasticsearch -n elasticsearch
</code></pre>
<p>This is what I get, when I check pods:</p>
<pre><code># kubectl get pods -n elasticsearch
NAME                                READY   STATUS     RESTARTS   AGE
elasticsearch-coordinating-only-0   0/1     Init:0/1   0          18m
elasticsearch-data-0                0/1     Running    6          18m
elasticsearch-data-1                0/1     Init:0/1   0          18m
elasticsearch-master-0              0/1     Init:0/1   0          18m
elasticsearch-master-1              0/1     Running    6          18m
elasticsearch-master-2              0/1     Init:0/1   0          18m
</code></pre>
<p>When I try  <code>kubectl describe pod</code> for <em>elasticsearch-data</em> and <em>elasticsearch-master</em> pods, they all have the same message:</p>
<pre><code>  0/3 nodes are available: 3 pod has unbound immediate PersistentVolumeClaims.
</code></pre>
<p><em>es-pv.yaml</em> describing PersistentVolumes:</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: elastic-master-pv
  labels:
    type: local
spec:
  storageClassName: ''
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  claimRef:
    namespace: elasticsearch
    name: data-elasticsearch-master-0
  hostPath:
    path: &quot;/usr/share/elasticsearch&quot;
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - node_name_1
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: elastic-master-pv-1
  labels:
    type: local
spec:
  storageClassName: ''
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  claimRef:
    namespace: elasticsearch
    name: data-elasticsearch-master-1
  hostPath:
    path: &quot;/usr/share/elasticsearch&quot;
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - node_name_0
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: elastic-master-pv-2
  labels:
    type: local
spec:
  storageClassName: ''
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  claimRef:
    namespace: elasticsearch
    name: data-elasticsearch-master-2
  hostPath:
    path: &quot;/usr/share/elasticsearch&quot;
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - node_name_1
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: elastic-data-pv
  labels:
    type: local
spec:
  storageClassName: ''
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  claimRef:
    namespace: elasticsearch
    name: data-elasticsearch-data-0
  hostPath:
    path: &quot;/usr/share/elasticsearch&quot;
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - node_name_0
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: elastic-data-pv-1
  labels:
    type: local
spec:
  storageClassName: ''
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  claimRef:
    namespace: elasticsearch
    name: data-elasticsearch-data-1
  hostPath:
    path: &quot;/usr/share/elasticsearch&quot;
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - node_name_1
root@shy-fog-vs:~/elasticsearch# cat es-values.yaml
resources:
  requests:
    cpu: &quot;200m&quot;
    memory: &quot;512M&quot;
  limits:
    cpu: &quot;1000m&quot;
    memory: &quot;512M&quot;

volumeClaimTemplate:
  storageClassName: local-storage
  accessModes:
  - &quot;ReadWriteOnce&quot;
  resources:
    requests:
      storage: 10Gi
minimumMasterNodes: 1
clusterHealthCheckParams: &quot;wait_for_status=yellow&amp;timeout=2s&quot;
readinessProbe:
   failureThreshold: 3
   initialDelaySeconds: 200
   periodSeconds: 10
   successThreshold: 3
   timeoutSeconds: 5
</code></pre>
<p>PersistentVolume and PersistentVolumeClaims seem to be alright:</p>
<pre><code># kubectl get pv
NAME                  CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                       STORAGECLASS   REASON   AGE
airflow-dags-pv       2Gi        RWX            Retain           Bound    airflow/airflow-dags-pvc                    manual                  112d
airflow-logs-pv       2Gi        RWX            Retain           Bound    airflow/airflow-logs-pvc                    manual                  112d
airflow-pv            2Gi        RWX            Retain           Bound    airflow/airflow-pvc                         manual                  112d
elastic-data-pv       10Gi       RWO            Retain           Bound    elasticsearch/data-elasticsearch-data-0                             15m
elastic-data-pv-1     10Gi       RWO            Retain           Bound    elasticsearch/data-elasticsearch-data-1                             15m
elastic-master-pv     10Gi       RWO            Retain           Bound    elasticsearch/data-elasticsearch-master-0                           15m
elastic-master-pv-1   10Gi       RWO            Retain           Bound    elasticsearch/data-elasticsearch-master-1                           15m
elastic-master-pv-2   10Gi       RWO            Retain           Bound    elasticsearch/data-elasticsearch-master-2                           15m
# kubectl get pvc -n elasticsearch
NAME                          STATUS   VOLUME                CAPACITY   ACCESS MODES   STORAGECLASS   AGE
data-elasticsearch-data-0     Bound    elastic-data-pv       10Gi       RWO                           16m
data-elasticsearch-data-1     Bound    elastic-data-pv-1     10Gi       RWO                           16m
data-elasticsearch-master-0   Bound    elastic-master-pv     10Gi       RWO                           16m
data-elasticsearch-master-1   Bound    elastic-master-pv-1   10Gi       RWO                           16m
data-elasticsearch-master-2   Bound    elastic-master-pv-2   10Gi       RWO                           16m
</code></pre>

Katsiaryna Dzibrova
<p>Short answer: everything is fine</p>
<p>Longer answer (and why you got that error):</p>
<blockquote>
<p>This is what I get, when I check pods:</p>
<pre><code># kubectl get pods -n elasticsearch
NAME                                READY   STATUS     RESTARTS   AGE
elasticsearch-coordinating-only-0   0/1     Init:0/1   0          18m
elasticsearch-data-0                0/1     Running    6          18m
elasticsearch-data-1                0/1     Init:0/1   0          18m
elasticsearch-master-0              0/1     Init:0/1   0          18m
elasticsearch-master-1              0/1     Running    6          18m
elasticsearch-master-2              0/1     Init:0/1   0          18m
</code></pre>
</blockquote>
<p>This actually indicates the volumes mounted and the pod has started (see the second master pod is running and the other two are are in &quot;Init&quot; stage)</p>
<blockquote>
<p>When I try <code>kubectl describe pod</code> for <em>elasticsearch-data</em> and
<em>elasticsearch-master</em> pods, they all have the same message:</p>
<p><code>0/3 nodes are available: 3 pod has unbound immediate PersistentVolumeClaims.</code></p>
</blockquote>
<p>This is actually <strong>expected</strong> the first time you start the chart. Kubernetes has detected you don't have the volumes, and goes off to provision them for you. During that time, the pods can't start as those disks haven't been provisioned (and therefore the <code>PersistentVolumeClaims</code> have not been bound -- hence the error.)</p>
<p>You should also be able to see from the events section in the <code>kubectl describe</code> how recently that message appeared and frequently it has appeared. It should read something like below:</p>
<pre><code>Events:
  Type     Reason   Age                    From     Message
  ----     ------   ----                   ----     -------
  Normal   Pulling  51m (x112 over 10h)    kubelet  Pulling image &quot;broken-image:latest&quot;
</code></pre>
<p>So here, the &quot;broken-image&quot; image has been pulled 112 times over the past 10 hours, and that message is 51 minutes old</p>
<p>Once the disks have been provisioned, and the <code>PersistentVolumeClaims</code> have been bound (the disks have been allocated to your claim), your pods can start. You can also confirm this by your other referenced snippet:</p>
<pre><code># kubectl get pv
NAME                  CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                       STORAGECLASS   REASON   AGE
airflow-dags-pv       2Gi        RWX            Retain           Bound    airflow/airflow-dags-pvc                    manual                  112d
airflow-logs-pv       2Gi        RWX            Retain           Bound    airflow/airflow-logs-pvc                    manual                  112d
airflow-pv            2Gi        RWX            Retain           Bound    airflow/airflow-pvc                         manual                  112d
elastic-data-pv       10Gi       RWO            Retain           Bound    elasticsearch/data-elasticsearch-data-0                             15m
elastic-data-pv-1     10Gi       RWO            Retain           Bound    elasticsearch/data-elasticsearch-data-1                             15m
elastic-master-pv     10Gi       RWO            Retain           Bound    elasticsearch/data-elasticsearch-master-0                           15m
elastic-master-pv-1   10Gi       RWO            Retain           Bound    elasticsearch/data-elasticsearch-master-1                           15m
elastic-master-pv-2   10Gi       RWO            Retain           Bound    elasticsearch/data-elasticsearch-master-2                           15m
</code></pre>
<p>You can see from this that the pv (Persistent Volume) has been bound to the claim and that is why your pods have started.</p>
