When viewing containers in a TKGm node, containerd incorrectly reports the status of a container as Running when its underlying process is not present on the node.
This can lead to nodes remaining stuck in Deleting state or cordoned state (SchedulingDisabled) because Kubernetes does not recognize that the container has been stopped.
From the Workload Cluster context, one or more of the following symptoms are observed:
kubectl get pods -n <pod namespace> -o wide
kubectl get nodes
While SSH directly to the node where the pod and its container(s) is running:
crictl ps
journalctl -xeu containerd
MON DD HH:MM:SS <node name> containerd[988]: time="MON DD HH:MM:SS.ssssssZ" level=info msg="StopPodSandbox for \"<container ID>\""
MON DD HH:MM:SS <node name> containerd[988]: time="MON DD HH:MM:SS.ssssssZ" level=error msg="StopPodSandbox for \"<container ID>\" failed" error="rpc error: code = DeadlineExceeded desc = failed to stop container \"<container ID>\": an error occurs during waiting for container \"<container ID>\" to be killed: wait container \"<container ID>\": context deadline exceeded"TCA 3.4
TCP: 5.1
This is caused by a race condition between containerd's Exit and Exec probes.
Containerd shows a container in Running state, however, the process does not actually exist on the node.
This issue is present in the following Tanzu kubernetes grid (TKGm) which use containerd v1.6.31 and it's resolved in the containerd v1.6.36 i v1.7.22.
image-builder-resource-bundle version:v1.30.13+vmware.1-tkg.1v1.33.1+vmware.1-tkg.1v1.32.5+vmware.1-tkg.1v1.31.9+vmware.1-tkg.1v1.30.13+vmware.1-tkg.1v1.29.15+vmware.1-tkg.1v1.28.15+vmware.7-tkg.1v1.27.16+vmware.1-tkg.1Workaround
Restart contained directly on the affected node which will correctly update the status of all containers on the node:
systemctl restart containerd
systemctl restart kubelet