Monday, June 1, 2026

Deleting k8s PODs

Step 1: Find out who owns the Pods

Run this command to check the OWNER KIND column, which tells you exactly what resource is recreating or holding onto your Pods:

kubectl get pods -o custom-columns=NAME:.metadata.name,OWNER_KIND:.metadata.ownerReferences[0].kind,OWNER_NAME:.metadata.ownerReferences[0].name
Use code with caution.

Step 2: Delete based on the Owner Type

Depending on the output from Step 1, use the matching command below to stop the Pods from restarting:

  • If Owner is ReplicaSet: A leftover ReplicaSet is likely spinning them up. Run kubectl delete rs <replicaset-name>.
  • If Owner is StatefulSet: Run kubectl delete statefulset <statefulset-name>.
  • If Owner is DaemonSet: Run kubectl delete daemonset <daemonset-name>.
  • If Owner is Job: Run kubectl delete job <job-name>.
  • If Owner is <none>: These are standalone "naked" Pods. Run kubectl delete pod <pod-name>.

Step 3: Fast Nuke (Alternative)

If you just want everything gone immediately and do not care about the owner type, you can delete the Pods directly by their label or name.

Delete by label

Run kubectl delete pods -l <key>=<value> (e.g., kubectl delete pods -l app=nginx).

Force delete

If a Pod gets stuck in a "Terminating" loop, force it closed by running kubectl delete pod <pod-name> --grace-period=0 --force.

No comments:

Post a Comment

Istio Learning Resources

Istio Basic Sample https://istio.io/latest/docs/examples/bookinfo/ ...