https://pulumi.com logo
#general
Title
# general
r

refined-pilot-45584

08/02/2023, 1:48 PM
If I have a Kubernetes/GKE/AKS/EKS Cluster and Deploy Resources to it using the Kubernetes Provider/Helm is there a way to when running a Pulumi Destroy to SKIP the deletion of all the Helm/Chart/Release/K8's objects based on the idea the Cluster will be destroyed?
s

salmon-account-74572

08/02/2023, 2:03 PM
I don’t believe there is, but I could be mistaken.
s

straight-arm-50771

08/02/2023, 2:31 PM
you can add delete protection. you can also edit the state to remove the cluster so it's not tracking it
r

refined-pilot-45584

08/02/2023, 2:58 PM
Editing the Pulumi state though would be a manual task yes?
s

straight-arm-50771

08/02/2023, 2:58 PM
yes
you could script it though I suppose, it's a CLI command
r

refined-pilot-45584

08/02/2023, 2:59 PM
Yeah fair; Although I think delete protection won’t work for me cause the whole stack destroy would error rather than skip protected resources.
s

straight-arm-50771

08/02/2023, 3:00 PM
if you set up depends and parents, you could make it the top-level resource
s

salmon-account-74572

08/02/2023, 3:03 PM
I don’t think adding delete protection would help here, but removing stuff from state (via
pulumi state delete
) might work. I wouldn’t remove the cluster, though (unless I am misunderstanding you, @refined-pilot-45584). I would remove the Helm/Chart/Release/K8s objects, since deleting the cluster will also, necessarily, delete those objects as well. Then a
pulumi destroy
will only delete the cluster and not worry about what’s deployed on the cluster.
r

refined-pilot-45584

08/02/2023, 8:14 PM
Yeah I am thinking about the this as the work around. I’m not sure yet how happy I am with it; The reason for doing it is that the cluster components that are deployed generate some unmanaged GCP resources haphazardly. This is by design for the CRDs deployed in the home charts. But it makes it really hard to delete the helm chart deployments. So I think this is the way. Yeah no I would not delete the cluster from the stack; just all deployed resources. And yeah; when the cluster is deleted those helm charts and CRDs are gone and the unmanaged resources. Self heal and delete as they are unmapped bingings I might try this use of a script that only runs on destroy, to remove state, let’s see how it goes.