GKE Backup – Understanding Google Kubernetes Engine Backup

backupgoogle-cloud-platformgoogle-kubernetes-engine

I am looking to understand things regarding Google Kubernetes Cluster backup . I came across this document but this seems to be more on GCP Anthos On premises GKE Cluster .

https://cloud.google.com/anthos/gke/docs/on-prem/archive/1.1/how-to/administration/backing-up

I saw few blogs talking of a GKE feature to create a clone of existing GKE Cluster but I cannot find any option in GCP Console to create new cluster by cloning an existing GKE Cluster.

https://blog.doit-intl.com/google-kubernetes-engine-cluster-migration-with-velero-4a140b018f32

Can somebody please confirm if this cloning feature is still available in GKE or it is deprecated ?

Apart from Cloning a GKE Cluster , we need to take backup of Cluster resources and PersistentVolumes. It seems Veloro is a useful tool for this and it is GKE aware.

https://velero.io/

I am looking for further suggestions regarding GKE Cluster backup which takes care of both Cluster resources and persistent volumes. Any recommendation/best practises from Google on GKE backup

Best Answer

I saw few blogs talking of a GKE feature to create a clone of existing GKE Cluster but I cannot find any option in GCP Console to create new cluster by cloning an existing GKE Cluster.

As to creating a new GKE cluster from the existing one as its clone, it looks like this option is still available but was moved to differnt section. Now it is available in cluster details (when you click on your cluster name) and is called DUPLICATE:

enter image description here

Creating cluster from templates in general has been removed from cloud console. You can read about it here:

GKE previously supported templates for clusters. Those templates were removed from Google Cloud Console ...

When we talk about backing up kubernetes cluster we need to keep in mind the basic distinction. One thing is backing up the cluster itself and another one is backing up it's workloads or resources deployed to it.

As for now there is no single tool which enables us to perform both operations altogether, at least not on managed kubernetes solutions such as GKE. Of course there are completely different possibilities of performing full backup of your cluster when it comes to on-premise kubernetes installation e.g. disk snapshots.

Velero (formerly known as Heptio Ark) is a great tool that enables you to back up and restore your Kubernetes cluster resources as well as persistent volumes. And it can be used with any public cloud provider or on-premises k8s installation.

However as you can read in Cluster Migration description there is one caveat when migrating persistent volumes between different cloud providers:

Velero can help you port your resources from one cluster to another, as long as you point each Velero instance to the same cloud object storage location. This scenario assumes that your clusters are hosted by the same cloud provider. Note that Velero does not natively support the migration of persistent volumes snapshots across cloud providers. If you would like to migrate volume data between cloud platforms, please enable restic, which will backup volume contents at the filesystem level.

As you can see it still can be done with the help of restic. However if you migrate workloads deployed on GKE to another GKE cluster, you don't need it.

As to backing up or cloning an existing GKE cluster (cluster itself, not its workload), an interesting approach is to save it as a code which can be used to easily re-create it later. You can use Infrastructure as Code tool such as terraform and it's import option.

Related Topic