Mounting GCE Persistent Disk on my local machine

2/18/2019

I am trying to mount a GCE persistent disk that was created by a Kubernetes PersistentVolumeClaim resource (on GKE) to my local machine.

I created a PersistentVolumeClaim (that creates a persistent volume in GCE):

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: profiler-disk
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi

I tried to use gcsfuse to mount the disk as is written in the documentation:

You can use the Google Cloud Storage FUSE tool to mount a Cloud Storage bucket to your Compute Engine instance. The mounted bucket behaves similarly to a persistent disk even though Cloud Storage buckets are object storage.

with the command:

gcsfuse profiler-disk hello

but I am getting:

daemonize.Run: readFromProcess: sub-process: mountWithArgs: mountWithConn: setUpBucket: OpenBucket: Unknown bucket "profiler-disk"

I was able to load an actual bucket, so this is not an authorization/authentication issue.

Does anyone know how to achieve this?

-- Amityo
google-cloud-platform
google-cloud-storage
google-kubernetes-engine
kubernetes

1 Answer

2/19/2019

I was able to copy the data using kubectl cp

kubectl <pod-name>:/path <local-path> -c <container-name>
-- Amityo
Source: StackOverflow