Persistent storage in kubernetes container

12/4/2014

There is problem , I can't link my pod container with persistent storage

This is config of my pod, where elastic is the name of the attached disk (same region, mounted and formatted as should), when I start the pod with this config I have this error:

Unable to mount volumes for pod elastic.etcd

I could link my container to any other type of volume either emptyDir or hostDir and all work fine. But in the case of the mounted disk not. And I really can't find some good example about persitsentDisk volumes.

id: elastic
kind: Pod
apiVersion: v1beta1
desiredState:
  manifest:
    version: v1beta1
    id: elastic
    volumes:
      - name: elastic-persistent-storage
        source:
          persistentDisk:
            pdName : elastic
            fsType : ext4
    containers:
      - name: elastic
        image: dockerfile/elasticsearch
        cpu: 1000
        volumeMounts:
          - name: elastic-persistent-storage
            mountPath: /data
        ports:
          - name: elastic
            containerPort: 9200
            hostPort: 9200
labels:
  name: elastic
  role: storage

elastic is the name of the disk in the same project, same region and attached to master node of claster. Also it is formatted and mounted.

Thanks!

-- baio
google-cloud-platform
kubernetes

1 Answer

12/4/2014

There is an example of mounting a PD in the github documentation: https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/volumes.md#creating-a-pd

PDs in GCE can only be attached to a single VM (in read/write mode), so if the disk is already attached to your master then it will not be possible to also attach it to the node on which your pod is scheduled. Try detaching the PD from the master and then scheduling the pod.

-- Robert Bailey
Source: StackOverflow