GKE: Protect cluster from accidental deletion

9/20/2019

Is there a way on Google Kubernetes Engine to prevent a cluster from accidental deletion.

I know that this can be set at the Compute Engine level as described in the relevant docs.

I cannot seem to be able to find sth at the cluster level.

-- pkaramol
google-cloud-platform
google-kubernetes-engine

1 Answer

9/20/2019

Exactly as you need it, to avoid deletion of a cluster an all the resources involved with it, there is still work to do ahead, some in favor some against as you can read in here [1] it's a discussion that it has been for quite a long time (almost 4 years) and some of those flags are set into the managed resources in GKE so only upgrades (or full cluster bye-bye) can be done but some of the flags may not work in other resources (like "protected") so, the handling for this is still charged to the user whom would need to be careful when applying YAMLs that may affect the configuration, deployment cycles and resources on his/her clusters. In GKE it actually prompts twice (even though it seems like once) when dumping a cluster see [2], but once again, is relying in the client.

I trust this information can be helpful for you.


[1] https://github.com/kubernetes/kubernetes/issues/10179

[2] https://cloud.google.com/kubernetes-engine/docs/how-to/deleting-a-cluster

-- JorgeHPM
Source: StackOverflow