Skip to content

Restart RKE2 Kubernetes Cluster

This guide provides a step-by-step procedure for restarting an RKE2 Kubernetes cluster with master nodes and agent nodes grouped into specialized roles (app, kafka, storage).

Our RKE2 cluster consists of:

  • Master nodes (control plane)
  • Agent nodes grouped by function:
    • App type — application workloads
    • Kafka type — Kafka broker pods
    • Storage type — persistent storage workloads

Check cluster health before proceeding:

Terminal window
# Verify all nodes are ready
kubectl get nodes
# Check control plane components
kubectl get pods -n kube-system
# Verify workload health
kubectl get pods --all-namespaces | grep -v Running

Follow this order to minimize service disruption:

  1. Storage type agents (one at a time)
  2. Kafka type agents (one at a time)
  3. App type agents (one at a time)
  4. Master nodes (one at a time)

Restart storage nodes one at a time to maintain quorum.

Terminal window
kubectl get nodes -l node-type=storage
Terminal window
# Replace <storage-node-1> with actual node name
kubectl drain <storage-node-1> \
--ignore-daemonsets \
--delete-emptydir-data \
--grace-period=120 \
--timeout=300s

SSH to the storage node and restart:

Terminal window
sudo reboot

Wait for service to stabilize after rebooting:

Terminal window
sudo systemctl status rke2-agent
Terminal window
kubectl uncordon <storage-node-1>
Terminal window
kubectl get node <storage-node-1>
kubectl get pods -o wide | grep <storage-node-1>

Wait 2-5 minutes between nodes to ensure storage replication stabilizes.


Restart Kafka nodes sequentially to maintain broker availability.

Terminal window
kubectl get nodes -l node-type=kafka
Terminal window
kubectl drain <kafka-node-1> \
--ignore-daemonsets \
--delete-emptydir-data \
--grace-period=120 \
--timeout=300s
Terminal window
sudo reboot

Wait for service to stabilize after rebooting:

Terminal window
sudo systemctl status rke2-agent
Terminal window
kubectl uncordon <kafka-node-1>
kubectl get node <kafka-node-1>
Terminal window
# Verify Kafka pods are running
kubectl get pods -n inma-kafka -o wide | grep <kafka-node-1>

Wait 3-5 minutes between nodes for broker synchronization.


Application nodes can be restarted in parallel or sequentially based on capacity.

Terminal window
kubectl get nodes -l node-type=app

You should drain one app nodes at time:

Terminal window
# Drain one at a time (safer)
kubectl drain <app-node-1> \
--ignore-daemonsets \
--delete-emptydir-data \
--grace-period=60 \
--timeout=300s
Terminal window
sudo reboot
Terminal window
kubectl uncordon <app-node-1>
# ... etc
Terminal window
# Check all application pods
kubectl get pods --all-namespaces -o wide | grep <app-node-1>
# Verify deployments are healthy
kubectl get deployments --all-namespaces

Restart master nodes one at a time to maintain control plane quorum.

Terminal window
kubectl get nodes -l node-role.kubernetes.io/master=true
Terminal window
ssh <master-node-1>
Terminal window
sudo reboot

4.2.3 Wait for control plane stabilization

Section titled “4.2.3 Wait for control plane stabilization”

On another master or from kubectl:

Terminal window
kubectl get nodes
kubectl get componentstatuses
Terminal window
sudo systemctl status rke2-server
kubectl get nodes
kubectl get pods -n kube-system -o wide | grep <master-node-1>

Wait 5-10 minutes for:

  • etcd member to rejoin cluster
  • control plane pods to stabilize
  • cluster state to synchronize

Restart each master sequentially with 5-10 minute intervals.

Terminal window
# Check all control plane components
kubectl get pods -n kube-system

Terminal window
kubectl get nodes

All nodes should show Ready.

Terminal window
# Check for pods not in Running state
kubectl get pods --all-namespaces | grep -v Running | grep -v Completed
# Check recent events
kubectl get events --all-namespaces --sort-by='.lastTimestamp' | tail -50
Terminal window
kubectl get endpoints --all-namespaces

Verify services have healthy endpoints.

Terminal window
kubectl get pv,pvc --all-namespaces

All PVs should be Bound and PVCs Bound.

Test critical application endpoints:

Terminal window
# check KalmarEnergi portal if all services work
https://portal.kalmarenergi.se

If drain hangs, check for:

Terminal window
# Pods with PDBs blocking eviction
kubectl get poddisruptionbudgets --all-namespaces
# DaemonSet pods (use --ignore-daemonsets)
kubectl get daemonsets --all-namespaces
# Local storage (use --delete-emptydir-data)
kubectl describe node <node-name> | grep -A 10 "Non-terminated Pods"

Force eviction (use cautiously):

Terminal window
kubectl drain <node-name> \
--ignore-daemonsets \
--delete-emptydir-data \
--force \
--grace-period=0

Check logs:

Terminal window
# For agents
sudo journalctl -u rke2-agent -f
# or for masters
sudo journalctl -u rke2-server -f

Common issues:

  • Certificate expiration
  • Disk space full
  • Network connectivity to master
  • Kubelet port conflicts

Check etcd member list:

Terminal window
kubectl exec -n kube-system etcd-<master-node> -- \
etcdctl --cacert=/var/lib/rancher/rke2/server/tls/etcd/server-ca.crt \
--cert=/var/lib/rancher/rke2/server/tls/etcd/server-client.crt \
--key=/var/lib/rancher/rke2/server/tls/etcd/server-client.key \
member list

If member is stuck, may need to remove and re-add (advanced recovery).

Check scheduler and node resources:

Terminal window
kubectl describe pod <pod-name> -n <namespace>
kubectl top nodes

Common causes:

  • Insufficient resources (CPU/memory)
  • Node selectors/affinity rules
  • Taints preventing scheduling

If issues arise during restart:

  1. Stop draining nodes — uncordon any drained nodes
  2. Restart affected services — restart RKE2 services if needed
  3. Restore from backup — if etcd corruption suspected

  • Test in non-production first — validate procedure in staging
  • Automate with scripts — reduce human error for repeated operations
  • Monitor during restart — watch metrics dashboards for anomalies
  • Document deviations — record any unexpected issues for future reference
  • Schedule during low traffic — minimize user impact
  • Communicate status — update stakeholders throughout process

  • Backup current etcd state
  • Verify cluster health pre-restart
  • Notify stakeholders of maintenance window
  • Restart storage type agents (sequential)
  • Verify storage backend health
  • Restart Kafka type agents (sequential)
  • Verify Kafka broker availability
  • Restart app type agents (sequential)
  • Verify application health
  • Restart master nodes (one at a time, 5-10 min intervals)
  • Verify control plane health
  • Run post-restart verification tests
  • Update monitoring dashboards
  • Document any issues encountered
  • Notify stakeholders of completion