Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not delete pods in Kubernetes

I tried installing dgraph (single server) using Kubernetes.
I created pod using:

kubectl create -f https://raw.githubusercontent.com/dgraph-io/dgraph/master/contrib/config/kubernetes/dgraph-single.yaml

Now all I need to do is to delete the created pods.
I tried deleting the pod using:

kubectl delete pod pod-name

The result shows pod deleted, but the pod keeps recreating itself.
I need to remove those pods from my Kubernetes. What should I do now?

like image 464
AATHITH RAJENDRAN Avatar asked Nov 21 '18 05:11

AATHITH RAJENDRAN


People also ask

How do I force delete Kubernetes pods?

If you are using any version of kubectl <= 1.4, you should omit the --force option. If the pod is stuck on unknown state, run the command kubectl patch pod <pod> -p '{"metadata":{"finalizers":null}}' to remove it from the cluster.

How do you remove unknown pods in Kubernetes?

If you just delete the ReplicaSet, then the ReplicaSet and it's Pods will be deleted. But the Deployment controller will again recreate the ReplicaSet and then the newly created ReplicaSet will create Pods again. But if you just delete the original Deployment, then everything for it will be deleted too.


1 Answers

I did face same issue. Run command:

kubectl get deployment

you will get respective deployment to your pod. Copy it and then run command:

kubectl delete deployment xyz

then check. No new pods will be created.

like image 70
hk' Avatar answered Sep 22 '22 15:09

hk'