kubernetes/delete-pod

Delete Pod

Delete a pod from the cluster.

pods
management

Command

kubectl delete pod <pod-name>

Explanation

Deletes a specified pod and triggers its graceful termination sequence. For pods managed by controllers like Deployments or ReplicaSets, Kubernetes automatically recreates replacements. It's often used to restart faulty pods or clear stuck workloads. You can use the '--force' and '--grace-period=0' options for immediate termination if required.

Common Use Cases

  • Force a pod restart under a Deployment or ReplicaSet
  • Remove failing or stuck pods
  • Clean up test or debug pods manually created

Best Practices

  • Avoid deleting pods directly in production unless necessary
  • Use controller-level restarts for managed workloads

Common Mistakes to Avoid

  • Deleting pods managed by controllers without understanding they'll be recreated automatically
  • Using '--force' without caution, which can lead to data loss in stateful workloads

Troubleshooting

Problem: Pod immediately respawns after deletion

Solution: It’s likely controlled by a Deployment or ReplicaSet. Delete or scale down the controller first.

Examples

Delete a specified pod

kubectl delete pod my-app-pod-1234