In case of unwanted or multiple copies, we can delete Helm Deployment and Namespace to free up space.
As part of our Server Management Services, we assist our customers with several Kubernetes queries.
In order to begin, our Support Techs recommend to install and configure a Kubernetes cluster, Helm, and access to a CLI or terminal.
Delete Helm Deployment
When we delete a Helm deployment it removes the components without deleting the namespace.
Now, let us see the steps our Support Techs employ to do the same.
1. Initially, we need to list Helm Deployments in the current namespace.
To do so, we run:
Then to list deployments in a specific namespace, we run:
helm list --namespace
And to list all Helm deployments in all namespaces, we run:
helm list --all-namespaces
This example shows deployments of the same name existing on different namespaces.
We need to find the exact release and the namespace.
2. Delete Helm Deployment
We may have already installed a Helm deployment. To remove that, we run:
Alternatively, we use the alias:
As a result, we can see a confirmation of removal.
For example, the command below removes a deployment named bob-chart on the namespace other:
helm uninstall bob-chart --namespace other
In Helm 2, we use the –purge option to delete the release and related Kubernetes components:
Finally, we list Helm deployments to confirm the release is no longer there.
Delete Helm Deployment and Namespace
When we delete the namespace, it deletes all the residing components. However, when we remove all deployments within a namespace, it does not remove the namespace.
Although we can generate a namespace when deploying a chart with –create-namespace, there is no method to remove it when we delete a release using Helm commands.
We can delete the namespace using the kubectl command.
1. To do so, we list all Namespaces
kubectl get namespace
The output will print all the namespaces, their status, and age.
2. Then we delete the Namespace
Now, the terminal will print a confirmation message.
For example, suppose we want to remove the other namespace. For that, we run:
kubectl delete namespace other
The namespace will no longer appear on the list and is available to use again.
[Stuck in between? We are here to assist you]
In short, we need to give careful consideration when we remove a Helm deployment or namespace. Today, we saw how our Support Techs perform the same.