kubernetes: GracefulNodeShutdown fail to update Pod status for system critical pods.

What happened?

Pods with a system-cluster-critical priority class set are not evicted by Graceful node shutdown when a node is slated to be shutdown. Instead they are evicted by the Taint Manager once the tolerationSeconds period expires.

What did you expect to happen?

I’d expect the presence of priority classes to be orthogonal to whether or not Graceful node shutdown evicts the pods or not. If graceful node shutdown runs on node shutdown then pods should be evicted before Taint Manager runs.

How can we reproduce it (as minimally and precisely as possible)?

Run a deployment with the below tolerations

priorityClass: system-cluster-critical

Schedule a node shutdown or trigger a shutdown event using gdbus

gdbus emit --system --object-path /org/freedesktop/login1 --signal 'org.freedesktop.login1.Manager.PrepareForShutdown' true

Observe that pods from the deployment enter a “Terminating” state and have conditions indicating they were evicted by the Taint manager

  - lastProbeTime: null
    lastTransitionTime: "2024-04-22T14:30:26Z"
    message: 'Taint manager: deleting due to NoExecute taint'
    reason: DeletionByTaintManager
    status: "True"
    type: DisruptionTarget

The pod status is never updated to show TerminationByKubelet and stays in Running state until the eviction by Taint Manager

Anything else we need to know?

Kubelet logs will indicate that the node shutdown manager finished terminating the pod but this doesn’t get reflected in the API.

shutdown_manager_linux.go:395] "Shutdown manager finished killing pod" pod="kube-system/coredns-5687d5bddb-fqlbh"

Pod in the API server

coredns-5687d5bddb-fqlbh                  1/1     Terminating   0          89m

Kubernetes version

$ kubectl version
Client Version: v1.29.3
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.3

Cloud provider

Akamai Connected Cloud (The cloud formerly known as Linode)

OS version

# On Linux:
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

$ uname -a
Linux lke-e2e-bcbc70-test-1a751f3d 6.1.0-0.deb11.17-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.69-1~bpo11+1 (2024-01-05) x86_64 GNU/Linux

Install tools

kubeadm

Container runtime (CRI) and version (if applicable)

Related plugins (CNI, CSI, …) and versions (if applicable)

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 22 (17 by maintainers)

Most upvoted comments

@avestuk, thank you!

We did have some issues in the past with a few types of workloads where statuses are not being correctly reflected or synchronised. I wonder if you found a regression or a wholly new issue. For example:

Which looks somewhat similar to the issue you are seeing.

There are also other currently open issues against the Graceful Node Shutdown that might also be related.

@kwilczynski

Graceful Node Shutdown settings are:

-    shutdownGracePeriod: 30s
-    shutdownGracePeriodCriticalPods: 10s

I am testing on a worker node.

The issue is that I’m seeing that the pod status is not being updated to reflect TerminationByKubelet. This means that the deployment controlling the pod never sees that another replica is needed and so no new pod is scheduled. This results in having to wait 300s for Taint Manager eviction. My expectation is that when Graceful Node Shutdown is configured that all pods are evicted from the node and rescheduled elsewhere in the cluster.

I’ll update the initial post to clarify what the current state of affairs is.