delete
Deleting Kubernetes Resources
Delete resources by filenames, stdin, resources and names, or by resources and label selector.
JSON and YAML formats are accepted. Only one type of the arguments may be specified: filenames, resources and names, or resources and label selector.
Command
$ kubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l label | --all)])
Example
Current state
$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
nginx 1/1 1 1 44s
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx-6db489d4b7-9wgn9 1/1 Running 0 28s
Command
$ kubectl delete deployments nginx
deployment.apps "nginx" deleted
Output
$ kubectl get deployments
No resources found in default namespace.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.
Last modified September 23, 2020: docs update (b46eb86)