Can we enable deletion-protection on GKE cluster similar to GCP VMs?

1k Views Asked by At

What the title says.

I want to prevent the accidental deletion of my GKE cluster, like VMs, where I can set the deletion-protection ON.

I checked the documentation, and terraform configs as well, but couldn't find any solution for the same.

Is there a way, this can be implemented? One way I can think of is to disallow via IAM, so no one has access to cluster deletion.

2

There are 2 best solutions below

0
gargalatas On BEST ANSWER

Looks like it's available now on google_container_cluster resource of terraform. I have no idea for to module "gke" way though.

Please also check the manual https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster

0
Gari Singh On

GKE does not have a "deletion-protection" setting. But as you said, you can use IAM to do this. We'd recommend assigning something like the roles/container.developer to users/groups who strictly work with Kubernetes objects.