1

Just thinking., Is there a possibility to move one of the GKE standard cluster from one GCP project to another project.? If someone has explored a way to do this please do share.

2 Answers2

2

No, you can't migrate a cluster from a project to another one. You need to copy your cluster, I mean, you need to redeploy your resources (it's quite easy, simply apply your yaml and that's all!!) and copy the data.

This last part is the hardest and depends on how your data are stored, inside the cluster, or in external services (Cloud SQL, Spanner,...). That is the tricky part.

guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76
0

As an option, you can re-create the cluster and migrate workloads (deployments, secrets, persistent volumes, etc.) using Backup for GKE.

Step-by-step:

  1. Re-create the GKE cluster & node pools in another project with the same configuration (taints, node pools names, etc.).
  2. Migrate workloads - create a backup of the original cluster and restore it to the target GKE cluster in another project. You can use UI to create a backup for the original cluster workloads, and use gcloud to create restore plan and restore workloads on the target cluster in another project (you need to use CLI/gcloud to restore the backup in another project because UI doesn't support this case, just specify target cluster & project with required operation arguments).
  3. Keep in mind that you need to assign proper IAM roles to the target GKE cluster service account to have access to the source GKE cluster backups (otherwise, you will get a forbidden error message during the restore operation). See required IAM roles for backup/restore.
  4. Also, you can face with the following error: googleapi: Error 403: Permission 'gkebackup.backups.execute' denied. To resolve this, you need to assign the proper IAM role to the special service account Kubernetes Engine Service Agent (service-xxxxx@container-engine-robot.iam.gserviceaccount.com) from the target project (where do you want to restore). IAM role (it could be Backup for GKE Admin) should be assigned on the source project (a project with GKE backups) to the mentioned service account `service-xxxxx@container-engine-robot.iam.gserviceaccount.com).
Dmytro Kutetskyi
  • 701
  • 6
  • 11