URL has been copied successfully!
URL has been copied successfully!
URL has been copied successfully!
Share:
Twitter
LinkedIn
Facebook
Reddit
Follow by Email
Copy link
Threads
Bluesky
Reading Time: 5 minutes

I spotted this one on the AKS Docs Tracker. The node auto-repair page on Microsoft Learn has a new preview section that lets you change what AKS does when a node goes NotReady. Until now you got the built-in sequence and that was it. Now you can pick the repair actions yourself, including draining the node first, or deleting it and scaling up a replacement.

That's a big change for anyone who has watched a node get rebooted underneath a stateful workload and wished they'd had a say. Here's how it works, what to check first and where it can bite.

How repair works today

AKS marks a node as unhealthy when it reports NotReady on consecutive checks within a 10-minute window, or when it reports nothing at all for 10 minutes. Once a node has stayed unhealthy for at least five minutes, AKS reboots it. If it's still unhealthy, AKS reimages it, and if it's a Linux node that still hasn't recovered, AKS redeploys it. It checks readiness after each step and stops as soon as the node is healthy again.

AKS retries that sequence up to three times, and the whole process can take up to an hour. Repairs run as the aks-remediator user. This is on by default for both AKS Automatic and AKS Standard clusters, so if the default suits you, there's nothing to do.

What to know before you change anything

The configuration is in preview, which means no SLA and best-effort support. There are also some warnings that deserve to be read properly before you touch anything.

In practice that means checking a few things up front.

  • Replicas and PodDisruptionBudgets. Critical workloads need enough replicas and a sensible PodDisruptionBudget (PDB), otherwise a repair can take them out.
  • Node-local data. Anything on the node's local disks, such as emptyDir volumes or local storage, is at risk with reimage and delete.
  • Spare capacity. Pods drained or evicted from a repaired node have to land somewhere, so the rest of the node pool needs room for them.
  • Your permissions. You need to be able to create or update the remediator-config ConfigMap in kube-system.

The feature also comes with limits worth knowing.

  • Best effort. AKS doesn't guarantee a repair brings a node back. If the node stays unhealthy, you still have to investigate it yourself.
  • Detection is fixed. Your configuration doesn't change the health thresholds or the retry counts. It only changes the actions.
  • Skipped nodes. AKS might not repair a node if a network problem stops it reporting status, if it fails to register, or if it has the node.cloudprovider.kubernetes.io/shutdown or ToBeDeletedByClusterAutoscaler taints. It also skips a node that's mid-upgrade with the cluster autoscaler scale-down annotations set for the upgrade.
  • Delete is VMSS only. Node deletion works on Virtual Machine Scale Set nodes, not standalone VMs.
  • Ephemeral OS disks. Nodes with ephemeral OS disks can't be deallocated. AKS records a Warning event instead.

Configuring AKS node auto-repair

You configure everything through a ConfigMap called remediator-config in the kube-system namespace. If you don't have a cluster to practise on, a small lab cluster does the job. These are the standard commands in PowerShell with the Azure CLI.

That gives you a three-node cluster and a kubeconfig pointing at it. Before changing anything, confirm you're on the right context and check whether a configuration already exists.

If the ConfigMap doesn't exist yet, you're on the defaults. If it does, read it before you apply anything. appConfig is a single JSON string, so replacing it with a partial example wipes out settings for any other features in there. Merge your changes in, and if GitOps owns the ConfigMap, change it at the source.

The example below drains the node and then uses reimage only for the VM repair. Save it as remediator-config.yaml.

Apply it and read it back to check that it stuck.

AKS picks up the change on an interval controlled by the platform, so give it time. If the JSON is invalid, the error is logged and the last valid configuration stays in effect, or the defaults apply if AKS never loaded a valid one. Removing the ConfigMap or the appConfig field also takes you back to the defaults.

Choosing the repair actions

The repair object is where the interesting decisions live. The actions run in this order, and AKS checks the node after each one.

ActionWhat it doesDefault
cordonAndDrainCordons the node and drains all pods before VM repairfalse
rebootReboots the VMtrue
reimageReimages the VM if the node isn't readytrue
redeployRedeploys the VM when the platform supports ittrue
deallocateDeallocates and then allocates the VM againfalse
deleteDeletes the node when the platform supports itfalse

The defaults only apply when you don't configure any action. The moment you set one action in repair, every action you leave out becomes false. That catches people out, because the drain-and-reimage example above also switches off reboot and redeploy. An explicit false counts as configuration, and a null value counts as unset. If you leave repair out, or set it to {} or null, you get reboot, reimage and redeploy.

You must select at least one VM repair action. Setting only cordonAndDrain, or setting every VM action to false, is invalid. Drain options from scheduled-event features aren't supported for cordonAndDrain.

If you'd rather replace a bad node than nurse it, the delete action has two options. This example deletes the node after scaling up a replacement, and it stops the deletion if that scale-up fails.

scaleUp defaults to true and deleteIfScaleUpFailed defaults to false. The second option needs scaleUp: true, and it's equivalent to leaving it out when it's false. Delete options on their own don't select a repair action. If you pick both deallocate and delete, the scale-up happens after deallocation and just before deletion.

There's another warning here worth repeating. Scaling up first doesn't guarantee the replacement capacity is Ready, and allowing deletion after a failed scale-up can reduce workload availability. The safeguard is a PDB that needs replacement pods to be Ready before eviction, so the deletion waits for them. This is a minimal example for an app labelled app: web.

Pick minAvailable to fit your replica count.

Watching what AKS does

When AKS repairs a node, it emits Kubernetes events from the aks-auto-repair source on the node object. The documented reasons are NodeRebootStart, NodeRebootEnd, NodeReimageStart, NodeReimageEnd, NodeRedeployStart and NodeRedeployEnd, plus matching Error events that carry the error message. The End events tell you the action finished, not that the node is healthy, so check readiness yourself.

That lists repair events for your nodes. The event reference only covers reboot, reimage and redeploy, so don't count on drain, deallocate and delete producing the same events.

AKS only keeps events for the past hour by default. If you want a history or alerts for repeated node problems, enable Container Insights, which stores events for up to 90 days. If you see persistent repair errors you can't clear, it's worth raising a support case. It's also worth building auto-repair timing into your incident planning, because the whole process can take up to an hour.

Wrapping up

Node auto-repair finally lets you decide what happens to an unhealthy node. You can drain before repair, skip steps you don't trust, or replace the node outright. The catch is that every one of those choices comes with a way to hurt a workload, which is why the warnings about interruption, node-local data, storage dependencies and spare capacity matter so much.

If you try it, let me know how it goes.

Share:
Twitter
LinkedIn
Facebook
Reddit
Follow by Email
Copy link
Threads
Bluesky

Pixel Robots.

I’m Richard Hooper aka Pixel Robots. I started this blog in 2016 for a couple reasons. The first reason was basically just a place for me to store my step by step guides, troubleshooting guides and just plain ideas about being a sysadmin. The second reason was to share what I have learned and found out with other people like me. Hopefully, you can find something useful on the site.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *