0

I added a pod through Kubernetes Dashboard. I used Create new resource and I created a pod from input.

I then tried to delete it with:

kubectl delete -n default pod pod-name-0

It deletes it, but gets redeployed. As I understand, I should delete it's deployment first. So to list deployments, I used

kubectl get deployments

But it's not there. How do I permanently delete a pod?

lovrodoe
  • 473
  • 8
  • 18
  • You can check the output of `kubectl get all` this should display all (usual) workloads. My guess is that something like a ReplicaSet was created together with your pod. E.g a ReplicaSet would recreate missing workloads. – BeWu May 11 '21 at 08:32
  • I created a StatefulSet, so I had to delete that. Thanks, your command helped. – lovrodoe May 11 '21 at 08:48

1 Answers1

2

The pods are maintained by a ReplicationController and they are automatically replaced if they fail, are deleted, or are terminated, you should check

kubectl describe pods POD_NAME
kubectl describe replicationcontrollers/REPLICATION_CONTROLLER_NAME

Alternatively you can check the ReplicaSet kubectl get rs

Afterwards you can: kubectl edit rs REPLICASET_NAME and change the replicas count up or down as you desire.

Nice explanation regarding ReplicaSet vs ReplicationController

dejanualex
  • 3,872
  • 6
  • 22
  • 37