Uninstalling CloudBees Previews

1 minute read

Before removing CloudBees Previews from your cluster, delete all existing environments using the following commands:

$ kubectl delete gitrepository -A --all --wait=true $ kubectl delete environment -A --all --wait=true $ kubectl wait --for delete environment -A --all

If you uninstalled the Helm chart before this step, you cannot easily delete the Environment resources anymore since they have a finalizer registered which prevents them from being deleted until the CloudBees Previews Kubernetes controller terminates them gracefully. Therefore, it is strongly recommended that you remove these resources before uninstalling the chart. If you have already uninstalled the chart, and still want to remove those resources, you must either reinstall the chart and then delete the resources or manually delete each of the Environment resources and remove the finalizers as well as all other resources they created.

To uninstall the CloudBees Previews Helm chart, run:

$ helm uninstall --namespace previews previews

During the uninstallation, a Job runs as a pre-delete Helm hook in order to delete the ValidatingWebhookConfiguration hnc-validating-webhook-configuration. If you run the helm uninstall command with the --no-hooks option, you must delete ValidatingWebhookConfiguration before uninstalling the chart or the uninstallation will fail.

Please note that Helm does not remove the previews namespace or any CustomResourceDefinitions (CRD). To remove these resources as well, run:

$ kubectl delete namespace previews $ kubectl delete crds environments.environment.cloudbees.com \ gitrepositories.environment.cloudbees.com \ hierarchyconfigurations.hnc.x-k8s.io \ hncconfigurations.hnc.x-k8s.io \ subnamespaceanchors.hnc.x-k8s.io

Deleting CRDs also deletes all corresponding custom resources without gracefully terminating them or cleaning up their states. Therefore all custom resources should be deleted while the Helm chart is still installed and before removing the CRDs.