kubernetes: Graceful node shutdown conflicts with unattended-upgrades package
What happened:
setting shutdownGracePeriod: “60s” and shutdownGracePeriodCriticalPods: “30s” in /etc/kubernetes/kubelet-config.yaml results in /var/log/kubelet.log messages like: Jun 2 19:41:48 test-c2rtl5620bsn3hi5voeg-kublettest1-default-0000042f kubelet.service[7402]: E0602 19:41:48.214662 7402 kubelet.go:1404] “Failed to start node shutdown manager” err=“node shutdown manager was unable to update logind InhibitDelayMaxSec to 1m0s (ShutdownGracePeriod), current value of InhibitDelayMaxSec (30s) is less than requested ShutdownGracePeriod”
What you expected to happen:
I expected the graceful node shutdown configuration settings to take precedence.
How to reproduce it (as minimally and precisely as possible):
configure graceful node shutdown (shutdownGracePeriod: “60s” and shutdownGracePeriodCriticalPods: “30s” ) on a node with the unattended-upgrades package installed
check the log for messages indicating “node shutdown manager was unable to update logind InhibitDelayMaxSec …”
Anything else we need to know?:
unattended-upgrades writes /usr/lib/systemd/logind.conf.d/unattended-upgrades-logind-maxdelay.conf containing InhibitDelayMaxSec=30
the Kubernetes code writes /etc/systemd/logind.conf.d/99-kubelet.conf which contains a definition of InhibitDelayMaxSec ultimately based on the values in /etc/kubernetes/kubelet-config.yaml
/usr/lib/systemd/logind.conf.d/unattended-upgrades-logind-maxdelay.conf has a higher precedence than /etc/systemd/logind.conf.d/99-kubelet.conf so the InhibitDelayMaxSec value in /usr/lib/systemd/logind.conf.d/unattended-upgrades-logind-maxdelay.conf is used.
for any value other than 30 seconds … the Kubernetes implementation of GracefulNodeShutdown is incompatible with the unattended-upgrades package
Environment:
-
Kubernetes version (use
kubectl version): kubectl version Client Version: version.Info{Major:“1”, Minor:“21”, GitVersion:“v1.21.1+IKS”, GitCommit:“04e16b9d6c7af21e462f7ac675c34b667cd6149e”, GitTreeState:“clean”, BuildDate:“2021-05-24T08:21:44Z”, GoVersion:“go1.16.4”, Compiler:“gc”, Platform:“linux/amd64”} Server Version: version.Info{Major:“1”, Minor:“21”, GitVersion:“v1.21.1+IKS”, GitCommit:“04e16b9d6c7af21e462f7ac675c34b667cd6149e”, GitTreeState:“clean”, BuildDate:“2021-05-24T08:19:13Z”, GoVersion:“go1.16.4”, Compiler:“gc”, Platform:“linux/amd64”} -
Cloud provider or hardware configuration: IBM Cloud
-
OS (e.g:
cat /etc/os-release): cat /etc/os-release NAME=“Ubuntu” VERSION=“16.04.7 LTS (Xenial Xerus)” ID=ubuntu ID_LIKE=debian PRETTY_NAME=“Ubuntu 16.04.7 LTS” VERSION_ID=“16.04” HOME_URL=“http://www.ubuntu.com/” SUPPORT_URL=“http://help.ubuntu.com/” BUG_REPORT_URL=“http://bugs.launchpad.net/ubuntu/” VERSION_CODENAME=xenial UBUNTU_CODENAME=xenial -
Kernel (e.g.
uname -a): uname -a Linux test-c2v7ef52068f5kndi8s0-testcluster-default-000002f4.iks.ibm 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux -
Install tools:
-
Network plugin and version (if this is a network-related bug):
-
Others:
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 34 (17 by maintainers)
@iscultas Thank you for the investigation analysis.
This issue took me an evening to crack, but I seem to have figured it out. The problem resides not in Kubernetes but in the unattended-upgrades package itself.
As stated in logind.conf documentation,
and
In short, logind.conf.d directories are treated as a single directory, and the option value of the last of sorted files prevails.
What is happening?
InhibitDelayMaxSeclocal override at/etc/systemd/logind.conf.d/99-kubelet.conf.InhibitDelayMaxSeclocal override at/usr/lib/systemd/logind.conf.d/unattended-upgrades-logind-maxdelay.conf.unattended-upgrades-logind-maxdelay.confbecomes the last of sorted files and overrides99-kubelet.conf.By ignoring login.conf documentation recommendation
unattended-upgrades package caused this and probably some other issues where
InhibitDelayMaxSecoverrides were needed.How this issue can be resolved?
For the current setups
e. g. create
/etc/systemd/logind.conf.d/unattended-upgrades-logind-maxdelay.conf -> /dev/nullsymlink.In the long run
unattended-upgradespackage must change its logind.conf local override to include the prefix recommended above (e. g.10-unattended-upgrades-logind-maxdelay.conf).