Automating Node Reboots in Kubernetes with kured
Kernel patches need reboots. Doing them by hand across a large cluster is slow and risky. kured, the Kubernetes Reboot Daemon, does it for you, one node at a time.
Why node reboots are hard
- Disruption: a careless reboot means downtime for whatever runs on the node.
- Coordination: you have to reboot without taking too much of the cluster down at once.
- Manual work: slow and error-prone across many nodes.
- Visibility: it's hard to track which nodes rebooted and came back healthy.
- Critical workloads: some pods shouldn't be interrupted at all.
What kured does
kured runs as a DaemonSet. On each node it watches for a sentinel file (by default /var/run/reboot-required, which many Linux distributions create after a kernel update). When the file appears, kured:
- takes a cluster-wide lock so only one node reboots at a time,
- cordons and drains the node,
- reboots it,
- uncordons it and releases the lock.
Patches get applied promptly, and nobody has to babysit the process.
Install
kured now lives under the kubereboot organization. Older guides point to weaveworks URLs, which no longer work.
With Helm:
helm repo add kubereboot https://kubereboot.github.io/charts
helm repo update
helm install kured kubereboot/kured --namespace kube-system
Without Helm, apply the release manifest:
latest=$(curl -s https://api.github.com/repos/kubereboot/kured/releases | jq -r '.[0].tag_name')
kubectl apply -f "https://github.com/kubereboot/kured/releases/download/$latest/kured-$latest-combined.yaml"
Configure
kured is configured with command-line flags. The ones that matter most:
--reboot-sentinel: the file that signals a reboot is needed.--start-time,--end-time,--time-zone,--reboot-days: the maintenance window.--drain-timeout: give up on a drain after this long. The default waits forever.--prometheus-url: don't reboot while Prometheus has active alerts.--blocking-pod-selector: don't reboot a node while pods matching this label run on it.--period: how often to check for the sentinel file (default 1 hour).
With Helm, set them in a values file:
configuration:
rebootSentinel: /var/run/reboot-required
startTime: "23:00"
endTime: "05:00"
timeZone: Asia/Kolkata
rebootDays: [mo, tu, we, th, fr]
drainTimeout: 30m
prometheusUrl: http://prometheus-server
blockingPodSelector:
- app=critical-batch
helm upgrade kured kubereboot/kured --namespace kube-system -f values.yaml
To keep kured off certain nodes entirely, stop its DaemonSet from scheduling there with a nodeSelector or node affinity.
Verify and test
kubectl get daemonset kured -n kube-system
kubectl logs -n kube-system daemonset/kured
To force a test reboot, create the sentinel file on a node. kured will pick it up on its next check, inside your maintenance window:
sudo touch /var/run/reboot-required
Afterwards, check the logs again to confirm the node drained, rebooted and rejoined.
Worth knowing
- Locking: kured stores its lock as an annotation on its own DaemonSet. That's what keeps reboots to one node at a time.
--concurrencyraises the limit if your cluster can take it. - Maintenance windows: line them up with your organization's change windows, so production never reboots at peak.
- Metrics: kured exposes Prometheus metrics, so you can alert on nodes that have needed a reboot for too long.