Tutorials

Kubernetes Deployment Delete Tutorial [How To]

Kubernetes Deployment Delete Tutorial [How To]
Written by itsubuntu

Last modified on October 4th, 2022 at 05:49 pm

Tutorial to delete Kubernetes deployments.

Kubernetes is an open-source container that is used for automating containerized software deployment, scaling, and management. In this Kubernetes tutorial post, we are going to show you the multiple methods to delete the Kubernetes deployment.

Kubernetes Deployment Delete Tutorial [How To]

If you are using Kubernetes regularly for the deployment of your containerized application then deleting Kubernetes deployment is a regular job. You can easily delete the deployments.

You can run the following command to delete the Kubernetes deployment:

kubectl delete deployment deployment-name

What if you don’t know the Kubernetes deployment name?

Don’t worry we are here to cover you as you can run the following command to know the Kubernetes deployment name.

kubectl get deployments

You will see the output like this:

NAME     READY   UP-TO-DATE   AVAILABLE   AGE
itsubuntu-dep   4/4     4            4           52m05s

Now, you can easily delete your Kubernetes deployment:

kubectl delete deployments itsubuntu-dep

What if you want to delete Kubernetes Deployment from a specific namespace?

Don’t worry about this too as we will guide you through the process of deleting Kubernetes deployment from the namespace. You can list all the deployments from all the namespaces with the following command:

kubectl get deployments --all-namespaces

Now, you can easily delete the Kubernetes deployment from the specified namespace.

For example:

kubectl delete deployments --namespace=testapps testapps-dep
deployment.apps "testapps-dep" deleted

What if you want to delete the multiple deployments?

Run the following command to delete multiple deployments

kubectl delete deployment its-dep its-dep-2 --namespace=default

This much for now. Let us know if you have queries related to this article or any suggestions that you want to give to us. We are regularly updating our blog posts with useful tutorials and resources.

About the author

itsubuntu

Leave a Comment