- Home
- CLI reference
- mkectl restore
mkectl restore
mkectl restore#
Restores from a backup of the MKE 4 Kubernetes management cluster.
Synopsis#
Restores from a backup of the MKE 4 Kubernetes management cluster.
An archive can only be restored by the mkectl build that wrote it. Restore compares the version and commit recorded inside the archive against its own and refuses a mismatch, so an archive taken before an upgrade needs the mkectl that took it - including scheduled archives left on the controllers by an earlier release.
mkectl restore [flags]
Examples#
mkectl restore --name backup.tar --hosts-path hosts.yaml
The --hosts-path file must contain a top-level 'hosts:' list — NOT a full mke4.yaml
config. Restore bootstraps a single-node cluster, so exactly ONE host is expected and
its role must be 'controller+worker' (the only supported controller role). If more than
one host is listed, only the first is used. Example hosts.yaml:
hosts:
- role: controller+worker
installFlags: # optional
- "--profile=custom-profile"
ssh:
address: 10.0.1.15
user: root
keyPath: ~/.ssh/key.pem
port: 22
bastion: # optional
address: 1.2.3.4
user: root
keyPath: ~/.ssh/bastion-key.pem
port: 22
Options#
--accept-noncurrent-config Proceed without prompting when the archive bundles a configuration the source cluster had not applied (a last-known-good snapshot, the client-supplied config, or an unapplied live spec). Unlike --force, which accepts losing the cluster's current state, this accepts a different configuration coming back
--chart-registry-password string Password for authenticating the Helm chart pulls restore's bootstrap triggers against the chart registry. Requires --chart-registry-username. Can also be set via the MKE_CHART_REGISTRY_PASSWORD environment variable.
--chart-registry-username string Username for authenticating the Helm chart pulls restore's bootstrap triggers against the chart registry. Requires --chart-registry-password.
--force Ignore user confirmation
-h, --help help for restore
--hosts-path string Path to the hosts.yaml naming the controller node to restore the cluster onto (required)
--image-registry-password string Password for authenticating the k0s binary presence check and download against the image registry. Requires --image-registry-username. Can also be set via the MKE_IMAGE_REGISTRY_PASSWORD environment variable.
--image-registry-username string Username for authenticating the k0s binary presence check and download against the image registry. Requires --image-registry-password.
--lease-adopt-stale if true, matching stale lease would be adopted instead of failing with error
--lease-renew-interval duration lease renew interval for cluster-wide/node operations, should be < leaseTTL (default 20s)
--lease-ttl duration lease TTL for cluster-wide/node operations (default 1m0s)
--md5 string MD5 checksum of the backup file; restore fails if the file does not match
--name string Name and path of the snapshot to restore (default "backup.tar")
--passphrase string Decrypt the backup tar file with the provided passphrase. Use "-" to read it from stdin
--registry-insecure-skip-tls-verify Skip TLS verification for the image/chart registry
--temp-dir string Directory on the bootstrap node where k0s restore unpacks the archive; it needs free space at least the archive's uncompressed size. Overrides spec.backup.tempDir from the backup; when both are empty k0s uses /tmp
Options inherited from parent commands#
-f, --file string path to the config file. Not needed for restore where config is loaded from the backup (default "mke4.yaml")
--kubeconfig string path to the kubeconfig file of the existing or restored cluster. DO NOT USE when creating a new cluster (default "/home/runner/.mke/mke.kubeconf")
-l, --logLevel string specify a log level (info, warn, debug, trace, error) (default "info")
--no-color when provided, disables colored output
--no-pretty-print when provided, disables pretty print output formatting
--version version[=true] --version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version