Delete all Kubernetes services with a single Command

This is a Kubernetes tutorial on how to delete all Kubernetes services with a single line. Kubernetes is an open-source system for automating deployment, scaling and management of containerized applications. Kubernetes offers solutions like rolling updates which allow you to update sets of Pods without taking down the entire cluster.

Within Kubernetes, there is the Kubernetes Service object. Kubernetes Services can be used to represent a Kubernetes application such as a web server, database, etc. Kubernetes Services are responsible for providing Kubernetes Pods with stable and high-bandwidth network connectivity and hosting that communicate with their respective Kubernetes Cluster’s endpoints.

This blog post will be focused on how you can delete all Kubernetes services in a single line. The Kubernetes Service object is stored in the Kubernetes API which means that all of the Kubernetes services can be deleted if their corresponding API objects are deleted. In order to delete all Kubernetes services, you will need to first connect to your Kubernetes Cluster using kubectl.


The following kubectl command will delete all the services that running on the cluster (default namespace)

kubectl delete svc --all

About Kubectl

Kubectl is a Kubernetes command-line interface that allows you to manage Kubernetes clusters. With Kubectl, you can deploy, manage, and troubleshoot applications running in Kubernetes. Kubectl supports Kubernetes features such as Namespaces, Replication Controllers, Services, and Pods.