Forrest logo
back to the kubectl tool

kubectl-delete:tldr:4b1c1

kubectl-delete: Delete all pods in a specified namespace.
$ kubectl delete pods --all --namespace ${namespace}
try on your machine

The command "kubectl delete pods --all --namespace ${namespace}" is used to delete all pods within a specific namespace in Kubernetes.

Here's what each part of the command does:

  • "kubectl" is the command-line tool used to interact with a Kubernetes cluster.
  • "delete pods" is the action being performed, which is to delete pods.
  • "--all" is an option that specifies that all pods in the namespace should be deleted. This includes both running and pending pods.
  • "--namespace" is an option that specifies the namespace in which the pods are located.
  • "${namespace}" is a placeholder for the actual namespace name. You would replace this placeholder with the actual name of the namespace you want to delete pods from.

Example of usage: If you want to delete all pods in the "development" namespace, you would replace "${namespace}" with "development". The command would be: "kubectl delete pods --all --namespace development".

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the kubectl tool