Version/Environment:
This applies to deployments hosted in Amazon AWS.Issue:
A customer’s pod was failing to transition to a running state, it’s describe showed this event:Root Cause:
Container image pause is regularly used by kubernetes as a temporary placeholder for future containers during pod creation. Due to a problem in EKS there is a broken process in which a garbage collector is pruning images on nodes and removing the pause container image that is initially added as part of the node provisioning. Apparently it is no longer possible to fetch that “pause” from the default referenced location also due to a change on the EKS side. The EKS bug is partly discussed here: https://github.com/aws/amazon-vpc-cni-k8s/issues/2030#issuecomment-1372204463 The support for Container Runtime Interface (CRI) for Docker (Dockershim) has been discontinued with the introduction of Kubernetes 1.24 in EKS. Official Amazon EKS Amazon Machine Images (AMIs) now use containerd as the runtime exclusively. The issue occurs when kubelet, a key component of Kubernetes, seeks to garbage collect these “pause” containers. While Kubernetes offers credentials for obtaining pod images, containerd does not use these credentials when requesting the sandbox image. As a result, users who attempt to pull these images may experience authentication issues due to a lack of saved credentials in containerd. This drawback necessitates the re-deployment of nodes. To address this, kubelet offers the ‘—pod-infra-container-image’ flag which is specific to the EKS “pause” image. This flag has a two fold purpose: it guarantees that the image is not pruned by the image garbage collector and so helps prevent the occurrence of such issues. Ordinarily, kubelet should not undertake the garbage collection of the “pause” container. If this occurs, it may potentially result from various underlying causes, such as the “pause” being garbage collected due to disk pressure (evidenced by commands like (‘df -h /var/lib..’). For further insights and discussions related to these challenges and solutions, you may refer to the following resources:- Kubernetes GitHub issue discussing pause container image: https://github.com/kubernetes/kubernetes/issues/81756
- Rancher GitHub issue regarding Kubernetes and pause container: https://github.com/rancher/rke2/issues/1830
- Kubernetes GitHub issue about kubelet’s behavior and pause container: https://github.com/kubernetes/kubernetes/issues/62388
Resolution:
If you are witnessing this problem you can attempt to-
Ensure the nodes have policy AmazonEC2ContainerRegistryReadOnly, if not add it. The following can check.
- You can also try the bootstrap args listed in the link above.
- Check the root volume is sufficiently sized (#df -h | column -t) , also check that AMI versions used by the nodes is recent and compatible with EKS 1.24
- Check the config.toml on these nodes looks good, especially for sandbox_image.
- Check kubelet entry for —pod-infra-container-image
- If urgent you can cordon the broken node and cycle it out with a newer node.
- If the above does not work you can also attempt to cordon the node, restart kubelet on the effected node and uncordon the node:
- If the above does not help, you should contact AWS Support.