Protect nodes from automatic restart

Shturval automatically restarts nodes when node configuration changes or the cluster is updated. During an automatic restart, the platform performs the following actions:

  • Cordon;
  • Drain;
  • Reboot.

If needed, you can protect cluster nodes from automatic restart using special labels. Use this approach when you must perform operations before draining or rebooting a node.

Follow these steps:

  1. Block node drain.
  2. Apply the required changes.
  3. Verify that the node configuration reports the reboot required condition.
  4. Allow changes to be applied without drain, overriding the drain block.
  5. Wait for the node to reboot or for the configuration to be applied.
  6. Remove the permission to apply changes without drain.

Replace my-special-node with the actual node name in the commands below.

  1. To block drain on a node, set the node.shturval.tech/disable-drain label:
Command
kubectl label node my-special-node node.shturval.tech/disable-drain=
Screenshot

specialnodeaddlabel

  1. To verify that the label is set, run:
Command
kubectl get node my-special-node -o jsonpath='{.metadata.labels}' | jq -r
Screenshot

specialnodelabels

Please note! Complete the steps required to prepare the node for restart, then drain the node manually. The disable-drain label blocks only automatic drain.

  1. Allow changes to be applied by setting the node.shturval.tech/apply-as-is label. Please note! The apply-as-is label applies changes immediately without checking whether the node was drained.
Command
kubectl label node my-special-node node.shturval.tech/apply-as-is=
Screenshot

specialnodeapplyasis

  1. Verify that the node configuration (nodeconfig) is applied and reports ready=true:
Command
kubectl get nodeconfig my-special-node -o jsonpath='{.status.ready}'
Screenshot

specialnodestatus

  1. Remove the node.shturval.tech/apply-as-is label from the node to disable unconditional application of changes:
Command
kubectl label node my-special-node node.shturval.tech/apply-as-is-
Screenshot

specialnodeunlabeled

Please note! The node.shturval.tech/disable-drain label remains on the node and continues to block drain.