Command

Kubernetes Delete Resources by Label Command

The Kubernetes command to delete resources by label is kubectl delete pods,services -l name=myLabel.

Quick Answer

Command
kubectl delete pods,services -l name=myLabel
KubernetesCommand

Delete Resources by Label

Type this command
kubectl delete pods,services -l name=myLabel

Deletes pods and services carrying a matching label.

Learn More

How to delete resources by label in Kubernetes

  1. Open the terminal or command interface for Kubernetes.
  2. Type kubectl delete pods,services -l name=myLabel, replace any placeholders, and run it.

Kubernetes Delete Resources by Label Command

Run kubectl delete pods,services -l name=myLabel.

Related Commands

Frequently asked questions

What is the Kubernetes command to delete resources by label?

Run kubectl delete pods,services -l name=myLabel.

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