Create a kubernetes cluster using Disks is not allowed in GCP

9/4/2019

I want a kubernetes data to be backed up. So I have a persistent disk with kubernetes cluster and have set reclaimPolicy: Retain on storage.yaml file to make sure disks should not be deleted.

After the deletion of kubernetes cluster the disk retains on compute Engine -> Disks. But with the help of disk i am unable to create a kubernetes cluster. I have options only to create VM in GCP.

Is there a possible way to create a new kubernetes cluster with the existing disk on GCP

-- klee
google-cloud-platform
google-kubernetes-engine
kubernetes

1 Answer

9/4/2019

To use your existing Persistent Disk in a new GKE cluster, you'll need to first create the new cluster, then:

  • create and apply new PersistentVolume and PersistentVolumeClaim objects based on the name of your existing PD.
  • Once those exist in your cluster, you'll be able to give a Pod's container access to that volume by specifying values for the container's volumeMounts.mountPath and volumeMounts.name in the pod definition file.

You'll find more details about how to achieve this in the doc here.

-- LundinCast
Source: StackOverflow