In this short article, we will discuss how to use the kubectl delete deployment command in Kubernetes (K8S), explaining how to use it in a step-by-step format with examples.
How to use kubectl delete deployment command
- Open a terminal or command prompt and connect to your K8S cluster.
- View a list of deployments with the
kubectl get deploymentscommand. Use the-n <namespace>flag to specify the namespace of the deployment. - Delete the deployment with the
kubectl delete deployment <deployment name> -n <namespace name>.For example, if you had a deployment namedblog-deploymentin theblognamespace, you would runkubectl delete deployment blog-deployment -n blog.