Repository navigation
Taint a CKS node whose VM CloudStack knows is down - #14754
bhouse-nexthop wants to merge 1 commit into
Conversation
When a node VM of a running CKS cluster goes down, Kubernetes keeps its volumes attached and its stateful pods stuck until the node returns. The node.kubernetes.io/out-of-service taint (non-graceful node shutdown, default on from 1.26, GA in 1.28) lets Kubernetes force-detach the volumes and reschedule the pods. - New setting cloud.kubernetes.cluster.node.out.of.service.taint.enabled (default false) - The state scanner, for Running and Alert clusters on 1.26 or later: - taints a node whose VM is Stopped, Destroyed or Expunging - removes the taint once the VM is Running again - does nothing for transitional or unknown states - VM and cluster state are re-read right before each kubectl call, so a cluster being scaled, upgraded, stopped or having nodes removed is left alone - kubectl runs over SSH on any running control node; with none running the scan skips quietly - Tainted VM ids are kept in a cluster detail, written before tainting, so the taint is removed even after the setting is turned off, the cluster is restarted or a taint result is lost; a taint is re-sent until it is confirmed and every 10 minutes after Signed-off-by: Brad House <bhouse@nexthop.ai>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14754 +/- ##
============================================
+ Coverage 20.80% 20.82% +0.01%
- Complexity 20919 20961 +42
============================================
Files 6053 6054 +1
Lines 548451 548595 +144
Branches 78719 73309 -5410
============================================
+ Hits 114128 114224 +96
- Misses 420958 421002 +44
- Partials 13365 13369 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Lab test: passedTested on a nested KVM lab (3 hosts, Ceph RBD) running a main (24.0.0-SNAPSHOT) build with this commit, and Single control node, 2 workers. A StatefulSet (1 replica, 1Gi PVC) ran on worker A. Worker A was then stopped with
HA: 3 control nodes, 2 workers.
|
Description
Fixes #14753
When a CKS node VM goes down, Kubernetes keeps its volumes attached and stateful pods stay stuck until the node returns. This adds the non-graceful node shutdown taint
node.kubernetes.io/out-of-service=nodeshutdown:NoExecuteto the node while CloudStack knows its VM is down, and removes it when the VM runs again.cloud.kubernetes.cluster.node.out.of.service.taint.enabled, global, dynamic, defaultfalseoutOfServiceTaintedVms), written before tainting so a lost result still gets cleaned upWhy only those states: a host that is merely disconnected leaves its VMs Running in the DB, and the VM may well still be running. Stopped is only set once CloudStack has stopped the VM or HA has decided the host is down. Force-detaching a volume that is still in use risks corruption, so anything less certain is skipped.
Why default off: the taint makes Kubernetes attach the node's volumes elsewhere, which is only safe where "Stopped" really means powered off (e.g. host HA with fencing). Operators should opt in.
Types of changes
Feature/Enhancement Scale or Bug Severity
How Has This Been Tested?
KubernetesClusterNodeTaintWorkerTest(14 new)KubernetesCluster*Testin the plugin