google-cloud-platformnamespacesgoogle-kubernetes-enginenodesbackup

How to make backup of gke


I have a development cluster, in which I have two namespaces ns-a and ns-b. However, I'd like to create a backup of only nsb and make a copy of it in the whole new cluster.

How can I achieve it. Also, if any tutorials or documents on the same. Please share


Solution

  • In GKE there is a feature called Backup for GKE, it is a service for backing up and restoring workloads in GKE clusters.

    This will help for your scenario which is to create a backup plan only for one namespace and restore it in a new cluster. Follow below steps which I have replicated in my environment:

    1. Go to back up for GKE option in console you can find in the Kubernetes engine, there you can see an option on top called create a backup plan as shown below image, click on it

    image

    1. Fill out the basic details and expand for advanced options, in that you have Backup scope you can specify which parts you can back up for your requirements select the second option which is Selected namespace within the cluster and select the required namespace. image

    Then create a backup plan. Then it will create a backup plan and wait for the first backup.

    1. Now create a restore plan to restore the namespace in a new cluster, create a new cluster and go back to backup for the GKE page then on top you can find the option create a restore plan on top, click on it and fill the details.

    image

    Choose the backup plan which we have done in the previous step and choose the new cluster which we have created for restoring, click on create or you can explore more options in it.

    This will restore all the components within the namespace of the existing cluster to the new cluster.