0

I am trying to delete my pod with force deletion with the following command

kubectl delete pods my-pod-fg4ss --grace-period=0 --force

but my pod is recreating

my-pod-fg4ss 0/3 ContainerCreating 0 2d3h

I am unable to delete the pod

  • Does this answer your question? [Kubernetes pod gets recreated when deleted](https://stackoverflow.com/questions/40686151/kubernetes-pod-gets-recreated-when-deleted) – Mohsin Amjad Jul 29 '21 at 12:59

1 Answers1

3

Most likely this pod is part of a Deployment. In Kubernetes, when you have a deployment resource it needs to have a minimum of 1 replica so that's why when you delete a pod it automatically creates a new one.

In order to delete the pod, you have to actually delete the deployment:

kubectl get deployments

Get the name of the deployment (probably "my-pod") and delete it:

kubectl delete deployment <name>
CaioT
  • 1,973
  • 1
  • 11
  • 20