hardkubectl

Apply all manifests in a directory and delete labelled resources not present in the directory

command

kubectl apply --prune -f DIRECTORY -l APP=LABEL

also accepted

kubectl apply --prune

Command breakdown

Part of the Kubernetes CLI (kubectl) — Resource Operations category.

kubectlapply--prune-fDIRECTORY-lAPP=LABEL
FlagPurpose
--pruneBoolean flag
-fBoolean flag
-lBoolean flag

Test your recall — not just your reading.

Practice with interactive quiz →