Command

Kubernetes Delete All Pods in a Namespace Command

The Kubernetes command to delete all pods in a namespace is kubectl -n my-ns delete pod,svc --all.

Quick Answer

Command
kubectl -n my-ns delete pod,svc --all
KubernetesCommand

Delete All Pods in a Namespace

Type this command
kubectl -n my-ns delete pod,svc --all

Deletes every pod and service in a namespace.

Tip: The -n flag names the namespace; --all deletes every pod and service in it.

Learn More

How to delete all pods in a namespace in Kubernetes

  1. Open the terminal or command interface for Kubernetes.
  2. Type kubectl -n my-ns delete pod,svc --all, replace any placeholders, and run it.

Tip: The -n flag names the namespace; --all deletes every pod and service in it.

Kubernetes Delete All Pods in a Namespace Command

Run kubectl -n my-ns delete pod,svc --all.

Related Commands

Frequently asked questions

What is the Kubernetes command to delete all pods in a namespace?

Run kubectl -n my-ns delete pod,svc --all.

Where do I type this Kubernetes command?

Type it in the terminal or command-line interface used by Kubernetes.

Does this Kubernetes command work on Mac and Windows?

Yes. The command text is the same on both platforms when the tool is installed.

Official source · How we verify