Repository navigation
Closed
Labels
Description
Created a lot of pods (1000 across 2 nodes, approx 500 per node). Then deleted the namespace:
# oc delete ns clusterproject0
It started doing something because only 319 pods remain out of the 1000. But now it refuses to go further. Environment state and logs are below.
I haven't seen this before -- last similar run was on 3.2.0.1, though I only went to 250 pods per node at that code level (things worked ok).
# openshift version
openshift v3.2.0.5
kubernetes v1.2.0-36-g4a3f9c5
etcd 2.2.5
# oc get no
NAME STATUS AGE
dell-r620-01.perf.lab.eng.rdu.redhat.com Ready,SchedulingDisabled 19d
dell-r730-01.perf.lab.eng.rdu.redhat.com Ready 19d
dell-r730-02.perf.lab.eng.rdu.redhat.com Ready 19d
# oc get ns
NAME STATUS AGE
clusterproject0 Terminating 1d
default Active 19d
management-infra Active 19d
openshift Active 19d
openshift-infra Active 19d
# oc delete ns clusterproject0
Error from server: namespaces "clusterproject0" cannot be updated: The system is ensuring all content is removed from this namespace. Upon completion, this namespace will automatically be purged by the system.
All of the stuck-in-terminating pods were scheduled and run on one of the nodes. The other node was able to successfully terminate all pods that were running there.
From the master:
Mar 21 12:18:36 dell-r620-01.perf.lab.eng.rdu.redhat.com atomic-openshift-master[6683]: E0321 12:18:36.451332 6683 namespace_controller.go:139] unexpected items still remain in namespace: clusterproject0 for gvr: { v1 pods}
Mar 21 12:18:37 dell-r620-01.perf.lab.eng.rdu.redhat.com atomic-openshift-master[6683]: W0321 12:18:37.223252 6683 reflector.go:289] /usr/lib/golang/src/runtime/asm_amd64.s:2232: watch of *api.ServiceAccount ended with: 401: The event in requested index is outdated and cleared (the requested history has been cleared [24072046/23943693]) [24073045]
From the node that can't terminate it's pods:
Mar 21 12:22:49 dell-r730-01.perf.lab.eng.rdu.redhat.com atomic-openshift-node[7438]: W0321 12:22:49.119784 7438 kubelet.go:1850] Unable to retrieve pull secret clusterproject0/default-dockercfg-woua1 for clusterproject0/hellopods505 due to secrets "default-dockercfg-woua1" not found. The image pull may not succeed.
Activity
jeremyeder commentedon Mar 21, 2016
@derekwaynecarr @liggitt
jeremyeder commentedon Mar 21, 2016
Attached is a stacktrace taken from the wedged node, as requested by @ncdc
stack.txt
derekwaynecarr commentedon Mar 21, 2016
the nodes reported healthy as well, so node controller is not going to do anything...
liggitt commentedon Mar 21, 2016
what grace period is set for pods when deleting them as part of a namespace deletion?
derekwaynecarr commentedon Mar 21, 2016
@liggitt - none. we call delete collection, which in turn calls delete, which will pull the grace period from the strategy. https://github.com/kubernetes/kubernetes/blob/master/pkg/registry/generic/etcd/etcd.go#L398
liggitt commentedon Mar 21, 2016
so a stuck pod can block namespace deletion forever?
ncdc commentedon Mar 21, 2016
For more context, see the long discussion here: kubernetes/kubernetes#20497
derekwaynecarr commentedon Mar 21, 2016
@jeremyeder did the pod use a pvc with pv?
jeremyeder commentedon Mar 21, 2016
@derekwaynecarr no, there were no PVs in this environment at all. The pods simply run hello-openshift.
jeremyeder commentedon Mar 22, 2016
Had to stop docker on the node with all the stuck pods, dmsetup remove all the thin volumes there, reboot everything and then the namespace was able to clean itself up :/
ncdc commentedon Mar 22, 2016
@jeremyeder can you upload the logs for docker and the node somewhere (or maybe the entire journal from just before you deleted the project to a few minutes after)?
34 remaining items
derekwaynecarr commentedon Apr 1, 2016
Ha funny enough, I am not sure what caused it to unwedge, but now the pod that was hung for hours is disappeared along with namespace.
derekwaynecarr commentedon Apr 1, 2016
Basically, for this pod in question, after 4 hrs it finally unwedged:
Other pods on this node still remain wedged though.
derekwaynecarr commentedon Apr 1, 2016
When temporary isn't temporary, it appears bad things happen:
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/container/image_puller.go#L112
derekwaynecarr commentedon Apr 1, 2016
So if a kubelet finds itself with a pod in this status:
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kubelet.go#L3382
This state is basically the kubelet saying i don't know what state i am in exactly, so I think I need to look at this more tomorrow to see if we can get a more targeted test scenario that reproduces that state which results in a stuck pod when docker is not able to speak to the hub.
derekwaynecarr commentedon Apr 1, 2016
I see no good reason for us to treat RegistryUnavailable differently than any other error since in some cases the registry will never become available. I have now decided this is the most likely source of the wedge, and we should report that as a normal image pull error so the container can properly terminate.
Tomorrow, I will try to mock out an environment where we can simulate a pet image name whose pull always returns RegistryUnavailable to see if that can reproduce the scenario where the pod is not terminating as expected.
derekwaynecarr commentedon Apr 1, 2016
Great... so restarting docker unwedged the kubelet, and pods terminated as expected. Restarting docker again where it still no longer had network connectivity to the registry did not result in pods getting wedged when I created a handful on the node and then deleted the namespace. Creating 100 pods on the node where docker did not have connectivity to the registry did re-wedge the node and waiting 10 minutes before terminating the namespace did end up leaving 1 pod in a terminating state for what is now 18 minutes but I was an idiot and forgot to bump up the log level. So it looks like this is an issue if you have a kubelet at density that cannot contact the image registry and not just a kubelet running a few pods.
derekwaynecarr commentedon Apr 1, 2016
I can now reliably reproduce this error.
Modified the
kubeletto returnRegistryUnavailablewhen pullingopenshift/hello-openshift, launched a rc with 3 replicas, waited a minute or two for pods to appear hung in ContainerCreating state, delete the namespace, and voila! the pods never get deleted!derekwaynecarr commentedon Apr 1, 2016
Upstream PR: kubernetes/kubernetes#23746
metal3d commentedon Oct 16, 2016
and... any way to delete that pods ? I've got so much pod in that state...
ncdc commentedon Oct 17, 2016
@metal3d
oc delete pod/<name of pod> --grace-period=0will force deletion.metal3d commentedon Oct 17, 2016
A Big thanks ! @ncdc
anandbhaskaran commentedon Mar 27, 2018
I have 3 pods in Terminating status. Even the command from @ncdc hangs forever :(
anandbhaskaran commentedon Mar 27, 2018
Here is the detailed info:
patlachance commentedon Apr 25, 2018
@anandbaskaran if command provided by @ncdc still hangs, you can try forcing it with --force. It gives:
oc delete pod/ --grace-period=0 --force