Mount kubernetes' volume in development machine

5/24/2016

I have a Kubernetes cluster running on Google Cloud Platform. I have 3 nodes and several pods running on these nodes.

One of the pods runs Ghost blog platform and has mounted a gcePersistentDisk volume. The manifest file to create the pod:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    name: ghost
  name: ghost
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: ghost
    spec:
      containers:
      - image: ghost:0.7
        name: ghost
        env:
        - name: NODE_ENV
          value: production
        ports:
        - containerPort: 2368
          name: http-server
        volumeMounts:
            - name: ghost
              mountPath: /var/lib/ghost
      volumes:
        - name: ghost
          gcePersistentDisk:
            pdName: ghost
            fsType: ext4

I'd like someway to access this volume from my development machine. Is there any way to mount this disk in my machine?

-- dgil
gcloud
google-cloud-platform
kubernetes

1 Answer

5/24/2016

If your development machine is not part of the GCE cluster (i.e. a GCE VM), then you will not be able to directly mount it. Your best bet in that case would be to SSH to it via a machine it is mounted it (i.e the node your pod is scheduled to).

-- Saad Ali
Source: StackOverflow