Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a kubernetes cluster using Disks is not allowed in GCP

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

like image 355
klee Avatar asked Nov 06 '22 14:11

klee


1 Answers

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.

like image 152
LundinCast Avatar answered Nov 15 '22 09:11

LundinCast