kuberneteskubernetes-helm

Manage resources generated by other resources


I am working with someone else's kubernetes application. It has a long-running Deployment whose first action upon beginning to run is to create several additional, non-workload, cluster resources (ValidatingWebhookConfigurations and MutatingWebhookConfigurations in this case).

I would like for the generated resources to be deleted when their parent Deployment is deleted. Please assume that I don't have control over how the generated manifests are deployed, but do have control over their contents.

Questions:


Solution

  • You can use owner references and finalizers to create parent/child relationships between resources that allow you to clean up child resources when parent resources are deleted.

    Current docs: https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/