LinuxCommandLibrary

kubectl-delete

TLDR

Delete pod

$ kubectl delete pod [pod-name]
copy
Delete from manifest
$ kubectl delete -f [manifest.yaml]
copy
Delete all pods
$ kubectl delete pods --all
copy
Delete by label
$ kubectl delete pods -l [app=myapp]
copy
Force delete
$ kubectl delete pod [pod-name] --force --grace-period=0
copy
Delete namespace
$ kubectl delete namespace [namespace]
copy

SYNOPSIS

kubectl delete [options] resource [name]

DESCRIPTION

kubectl delete removes Kubernetes resources. It deletes pods, deployments, services, and other objects.
The command respects grace periods for graceful shutdown. Force delete bypasses graceful termination.
kubectl delete removes resources.

PARAMETERS

RESOURCE

Resource type.
NAME
Resource name.
-f FILE
Delete from file.
-l SELECTOR
Label selector.
--all
Delete all resources.
--force
Force deletion.
--grace-period N
Grace period seconds.
--help
Display help information.

CAVEATS

Subcommand of kubectl. Destructive operation. Consider --dry-run first.

HISTORY

kubectl delete provides resource removal for Kubernetes cluster management.

SEE ALSO

Copied to clipboard