Etcd is the persistent data store for Kubernetes. It is a distributed key-value store that records the state of all resources in a Kubernetes cluster. Etcd is a distributed reliable key-value store which is simple, fast and secure. It acts like a backend service discovery and database, runs on different servers in Kubernetes clusters at the same time to monitor changes in clusters and to store state/configuration data that should to be accessed by a Kubernetes master or clusters.
RKE clusters can be configured to take snapshots of etcd. In a disaster scenario, you can restore these snapshots. This snapshots can be shared outside cluster like s3 storage so that in case if we loose server, we will have backups to restore.
The plugin helps user to perform ETCD backup and restore of RKE1 clusters and enables the user to store the snapshot on s3 storage created using T4K target.
Add T4K custom plugin index of krew:
Installation:
Upgrade:
Removal:
Bash or ZSH shells:
Verify installation with: kubectl rke-etcd-backup-restore --help
-backup: Flag to notify the plugin to perform backup.
-restore: Flag to notify the plugin to perform restore.
--target-name: T4K target name.The target should be created and in available state. Currently S3 target type is supported. This target should be the target where the backups should be stored. This argument is mandatory if -backup flag is provided.
--target-namespace: Namespace name in which T4K target resides. This argument is mandatory if -backup flag is provided.
--rancher-url: This is the rancher server URL through which rancher can be accessed. should be given in the below form: "https://<rancher server ip>/" This is the URL to access rancher server. This is mandatory argument.
--bearer-token: This is the token provided by rancher server to access its cluster/apis without using password. More info about how to get bearer-token can be found at https://rancher.com/docs/rancher/v2.5/en/user-settings/api-keys/ The scope of API key should be "No scope" as to access API's, plugin needs access to complete scope of Rancher server This is mandatory argument.
--cluster-name: Rancher server hosts many RKE cluster, so specify the one cluster name for which ETCD backup is to be taken. This is mandatory argument.
--log-location: specify the log file location. default: /tmp/etcd-ocp-backup.log
A user may specify more than one option with each command execution. For example, to create a backup with a configured target name and associated namespace, and to set the cluster API URL with the associated bearer token, execute the following single command:
Then, to restore from the same cluster API URL with the associated bearer token, execute the following single command:
Restoring to a previous cluster state can be destructive and destabilizing action to take on a running cluster.
If restoring the backup which is a different T4K version than the one you are currently using, the operation fails and cluster accessibility is lost. The workaround is to delete the current T4K and then re-try restoring.
Supported GLIBC version ≥ 2.27.
Plugin is tested with RKE1 with kubernetes version v1.21.9.
Parameter | Description |
---|---|
-backup
Flag to notify backup is to be taken.
-restore
Falg to notify restore is to be performed.
--target-name
The name of a single datastore on which etcd backup needs to be stored i.e. T4K target name.
--target-namespace
Namespace name in which T4K target is created.
--rancher-url
Rancher server URL
--bearer-token
Token to access rancher server More info here
--cluster-name
Cluster name to perform Backup/Restore on.
--log-location
Log file name along with path where the logs should be save default - /tmp/etcd-ocp-backup.log