Etcd backups
A guide on how to create cluster etcd backups using Omni.
First of all, check the current overall status of the cluster backup subsystem:
If you have freshly created Omni instance, the output will be similar to this:
The combination of the CONFIGURATION NAME
and CONFIGURATION ERROR
fields display the current backup store configuration status. Currently, Omni supports two backup stores: local
and s3
. These are configured during Omni initialization. The output above indicates that the backup store is set to use the s3
store. However, the s3 configuration itself has not yet been added, so the CONFIGURATION ERROR
field shows not initialized
. The rest of the fields show as empty because no backups have been created yet.
S3 configuration
To use S3 as the backup storage, you will first need to configure the S3 credentials for Omni to use. This can be done by creating an EtcdBackupS3Configs.omni.sidero.dev
resource in Omni. Below is an example for Minio S3:
Let's go through the fields:
bucket
- the name of the S3 bucket for storing backups. This is the only field required in all cases.region
- the region of the S3 bucket. If not provided, Omni will use the default region.endpoint
- the S3 endpoint. If not provided, Omni will use the default AWS S3 endpoint.accesskeyid
andsecretaccesskey
- the credentials to access the S3 bucket. If not provided, Omni will assume it runs in an EC2 instance with an IAM role that has access to the specified S3 bucket.sessiontoken
- the session token (if any) for accessing the S3 bucket.
Save it as <file-name>.yaml
and apply using omnictl apply -f <file-name>.yaml
. During resource creation, Omni will validate the provided credentials by attempting to list the objects in the bucket. It will return an error if the validation fails and will not update the resource.
Let's get our overall status again and check the output:
Note that the CONFIGURATION ERROR
field is now empty, indicating that the provided configuration is valid.
Manual backup
Now, let's create a manual backup. To do that, we need to create a resource:
The <unix-timestamp>
should be no more than one minute in the future or in the past. The easiest way to get the current timestamp is to simply invoke date +%s
in your shell. The nanos
field should always be 0
.
After you save the resource as <file-name>.yaml
, apply it using omnictl apply -f <file-name>.yaml
. In a few seconds, you can check the status of the backup:
This command print per-cluster backup status. The output will be similar to this:
You can also get the overall status of the backup subsystem:
Automatic backup
Omni also supports automatic backups. You can enable this feature by directly editing the cluster resource Clusters.omni.sidero.dev
or by using cluster templates. Let's explore how we can do this in both ways.
Cluster templates
Enabling automatic backups using cluster templates is quite straightforward. First, you'll need a template that resembles the following:
This is the minimal example of a cluster template for a cluster with a single-node control plane and two worker nodes. Your machine UUIDs will be different, and the Kubernetes and Talos versions will probably also differ. You will need both of these, as well as the cluster name, in your cluster template. To obtain these, refer to the clustermachinestatus
and cluster
resources.
In this example, we are going to set the backup interval for the cluster to one hour. Save this template as <file-name>.yaml
. Before applying this change, we want to ensure that no automatic backup is enabled for this cluster. To do that, let's run the following command:
The Omni response will resemble the following:
Now that we have verified that Omni does not already have an automatic backup enabled, we will apply the change:
If you didn't have any backups previously, Omni will not wait for an hour and will immediately create a fresh backup. You can verify this by running the following command:
Keep in mind that to obtain the backup status, you will need to use the label selector omni.sidero.dev/cluster
along with your cluster name. In this example it is talos-default
.
Cluster resource
Another way to enable automatic backups is by directly editing the cluster resource. To do this, first, you'll need to retrieve the cluster resource from the Omni:
Add fields related to the backup configuration while preserving the existing fields:
Save it to the file and apply using omnictl apply -f <file-name>.yaml
. You will get the output similar to the one above for the cluster template.
Last updated