- Home
- Configuration
- Restore
Restore#
Important
- Run
mkectl restorewith the samemkectlbuild that created the backup. Restore compares the version and commit recorded in the archive against its own and refuses any mismatch. This requirement also applies to archives created before an upgrade, including scheduled backups that remain on the controller nodes. - You cannot use
mkectl restorewith the backup thatmkectl upgradecreates automatically,mke4preupgradesnapshot<timestamp>.tar. If the automatic rollback of a failed upgrade does not complete, restore the backup that you created before the upgrade. -
Disaster recovery:
-
Do not change the DNS name for the load balancer while performing disaster recovery. If you opt to deploy a new load balancer, ensure that it uses the same DNS name as the one in use by the original cluster.
-
Before you start disaster recovery, configure the load balancer so that it targets only the nodes of the recovered cluster. Remove every target that points to a node that is not part of the recovered cluster. The load balancer continues to route traffic to any target that passes its health checks, so a stale target silently receives cluster traffic, and the restore completes without an error.
-
During disaster recovery, the original nodes are not accessible in the new environment. As such, because the entire cluster will initially be brought up on a single node, some of the containers and processes may encounter resource issues. You can resolve these issues either by using a highly resourced node or through operating system configuration.
-
To restore an MKE 4 cluster, you bootstrap a new cluster fromm a backup and then bring the rest of the cluster back online.
| Restore scenario | Description |
|---|---|
| Restore to the same configuration | Recreate the cluster with the same nodes, roles, and configuration as the backup. Commonly used to rollback after an unwanted change. |
| Restore to a different node configuration | Restore onto nodes that differ from the original, such as different names, IP addresses, labels, or annotations. |
| Disaster recovery | Recover onto new infrastructure, as your original infrastructure is no longer available and the original cluster is irretrievable. |
Warning
-
Flatten every node that you use for disaster recovery. Stale state from a previous MKE 4 or k0s cluster can corrupt the recovered cluster. To flatten a node, wipe the volumes that back the following locations:
- The operating system root.
- The k0s data directory,
/var/lib/k0sby default.
-
You must configure the bootstrap node appropriately before you attempt disaster recovery. For example, you may need to configure
max_user_instancesandmax_user_watchesto a higher non-default value, as exemplified:sudo sysctl fs.inotify.max_user_instances=1280 sudo sysctl fs.inotify.max_user_watches=655360
Bootstrap a new cluster#
The first step in the restore process is to bootstrap a new cluster on a single node from the backup tar file:
-
Prepare a
hosts.yamlfile that contains the information needed to SSH into the bootstrap node:hosts: - ssh: address: <bootstrap-node-ip-address> user: <SSH-user-name> port: <ssh port> keyPath: <full-path-to-SSH-private-key> role: controller+worker -
Restore the cluster:
mkectl restore -l debug --hosts-path <full-path-to-hosts.yaml-file-on-node-from-which-you-run-mkectl> --name <backup-tar-file>
Add additional cluster nodes#
-
Add the required additional nodes to the
mke4.yamlconfiguration file that was generated as a result of bootstrapping a new cluster.Tip
You can use the newly generated
mke4.yamlconfiguration file to add the remaining nodes to the cluster, as well as to construct a one-to-one correspondence between nodes in the original cluster and nodes in the recreated cluster through the use of node labels. -
Run the
mkectl applycommand.
Rebalance the nodes#
Info
Rebalancing is not a factor for clusters that have a single controller node.
After you restore a cluster, all MKE 4 system components run on the single
bootstrap node and are not automatically rebalanced when the remaining control
plane nodes rejoin as a result of the mkectl apply command. As such, although
all Pods report Running, critical management components remain on the
bootstrap node.
To restore High Availability and to enhance node use, once all of the control
plane nodes have rejoined the cluster and reported as Ready, force a rollout
to reschedule the components across the nodes:
kubectl rollout restart deployment -n mke
kubectl rollout restart deployment -n k0rdent