How to Delete a Deployment in Kubernetes

In this post I will show you hwo to delete a deployment on a Kuberetes cluster using two methods.

Delete

When it comes to deployment, we have two options to delete them. First, using the Kubectl command or using a configuration file.

If you used a configuration file to deploy the deployment, you could either use the configuration file to delete or kubectl.

Before deleting, let’s start running the following command to check which deployments are running on the cluster.

kubectl get deployment

Once you have the name of the deployment from the output, use the following command.

kubectl delete deployments nginx-deployment

If you used a configuration file for the deployment you can also use the following command.

kubectl delete -f deploy.yaml 

Posted

in

by