lifecycle

kubectl delete

Deletes one or more resources by name, label, or manifest. Supports graceful termination, forced eviction of stuck pods, and cascading deletion of owned objects.

kubectl delete ([-f FILENAME] | TYPE [NAME | -l label | --all]) [flags]

Common flags

Flag Purpose
-f, --filename Delete every resource defined in a file, directory, or URL.
-l, --selector Delete resources matching a label selector.
--all Delete all resources of the given type in the namespace.
--grace-period Seconds before force kill; -1 uses object default, 0 with --force is immediate.
--force Skip graceful shutdown (use with --grace-period=0 for stuck pods).
--cascade background, foreground, or orphan to control garbage collection of dependents.
--wait Wait for the resource to be fully deleted before returning.

Examples

kubectl delete pod web-abc

Graceful deletion of a single pod.

kubectl delete -f deploy.yaml

Remove every resource defined in a manifest.

kubectl delete pod web-abc --grace-period=0 --force

Force-evict a stuck pod (last resort).

kubectl delete deploy,svc -l app=old

Bulk delete Deployments and Services by label.

Gotcha

--force does not remove the object from etcd if the API is unreachable; it just skips kubelet's graceful shutdown. --cascade=orphan leaves ReplicaSets/pods running after their owner is gone.

Related commands

← All kubectl commands · Docker vs Kubernetes