kubernetes PersistentVolumeClaim not bound, but volume is bound

7/20/2017

I'm new to Kubernetes and I'm following the GKE Elasticsearch 5 Getting Started doc. I cannot get the cluster to start when using the PersistentVolumeClaim and the configMap (mounting local, my laptop, path to containers). It works when the configMap is removed.

kubectl version:

Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.0", GitCommit:"d3ada0119e776222f11ec7945e6d860061339aad", GitTreeState:"clean", BuildDate:"2017-06-29T23:15:59Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.4", GitCommit:"d6f433224538d4f9ca2f7ae19b252e6fcb66a3ae", GitTreeState:"clean", BuildDate:"2017-05-19T18:33:17Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}

kubectl describe pod some-elasticsearch outputs the error:

[SchedulerPredicates failed due to persistentvolumeclaim "elasticsearchdata" not found, which is unexpected., SchedulerPredicates failed due to persistentvolumeclaim "elasticsearchdata" not found.

[SchedulerPredicates failed due to PersistentVolumeClaim is not bound: "elasticsearchdata", which is unexpected., SchedulerPredicates failed due to PersistentVolumeClaim is not bound

The volume is shown as bound. Any suggestions? Here's my pod.yaml:

metadata:
  name: some-elasticsearch
  labels:
    name: some-elasticsearch
spec:
  containers:
    - image: launcher.gcr.io/google/elasticsearch5
      name: elasticsearch
      volumeMounts:
        - name: elasticsearchdata
          mountPath: /usr/share/elasticsearch/data
        - name: elasticsearchconfig
          mountPath: /usr/share/elasticsearch/config
  volumes:
    - name: elasticsearchdata
      persistentVolumeClaim:
        claimName: elasticsearchdata
    - name: elasticsearchconfig
      configMap:
        name: elasticsearchconfig
---
# Request a persistent volume from the cluster using a Persistent Volume Claim.
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: elasticsearchdata
  annotations:
    volume.alpha.kubernetes.io/storage-class: default
spec:
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 5Gi

If I comment out the elasticsearchconfig, the cluster starts successfully:

- name: elasticsearchconfig
  mountPath: /usr/share/elasticsearch/config

- name: elasticsearchconfig
  configMap:
    name: elasticsearchconfig

Output from kubectl describe pvc elasticsearchdata:

Name:       elasticsearchdata
Namespace:  default
StorageClass:   standard
Status:     Bound
Volume:     pvc-52f0d3d2-6d57-11e7-94f6-42010af002a5
Labels:     <none>
Annotations:    pv.kubernetes.io/bind-completed=yes
        pv.kubernetes.io/bound-by-controller=yes
        volume.alpha.kubernetes.io/storage-class=default
        volume.beta.kubernetes.io/storage-provisioner=kubernetes.io/gce-pd
Capacity:   5Gi
Access Modes:   RWO
Events:
  FirstSeen LastSeen    Count   From                SubObjectPath   Type        Reason          Message
  --------- --------    -----   ----                -------------   --------    ------          -------
  2m        2m      1   persistentvolume-controller         Normal      ProvisioningIgnoreAlpha both "volume.alpha.kubernetes.io/storage-class" annotation and storageClassName are present, using storageClassName
  2m        2m      1   persistentvolume-controller         Normal      ProvisioningSucceeded   Successfully provisioned volume pvc-52f0d3d2-6d57-11e7-94f6-42010af002a5 using kubernetes.io/gce-pd

I want to have persistent storage and need to load a custom elasticsearch.yml from the elasticsearchconfig configMap.

-- Flash
elasticsearch
kubernetes

0 Answers