Deleting a Service or Deployment

Use the kubectl command to delete a service or deployment in a Kubernetes cluster.

Objects can be deleted easily within Kubernetes so that the environment can be cleaned up. Use the kubectl delete command to remove an object.

To delete an entire deployment, and all pod replicas running for that deployment, specify the deployment object and the name that you used to create the deployment. For example:

kubectl delete deployment hello-world