talos-backup

module
v0.1.0-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2023 License: MPL-2.0

README

talos-backup

talos-backup is a dead simple backup tool for Talos Linux-based Kubernetes clusters. The goal is simple: run this as a cronjob in a desire cluster, take an etcd snapshot, push said snapshot to s3.

Installation

talos-backup runs directly in Kubernetes on a given Talos cluster.

To enable the necessary Talos API access for a pod you will need the following modifications in your machine config:

spec:
  machine:
    features:
      kubernetesTalosAPIAccess:
        enabled: true
        allowedRoles:
        - os:etcd:backup
        allowedKubernetesNamespaces:
        - default

You will need a public/private key pair to encrypt(public key) and decrypt(private key) your backups. This service uses age for encryption. Find installation instructions here. Run age-keygen and backup the keys in a place where you won't lose them.

The file cronjob.sample.yaml specifies a kubernetes CronJob that backs up a cluster every 10 minutes. Customize it and substitute the age public key. S3 configurations may be supplied in whatever way the Go AWS SDK v2 expects them, in this example we happen to use environment variables.

Apply the CronJob:

kubectl apply -f cronjob.sample.yaml

To test what you deployed you can trigger the job manually:

kubectl create job --from=cronjob/talos-backup my-test-job

Development

You may build the binary with:

make talos-backup

or as a container image with:

make REGISTRY=registry.example.com USERNAME=myusername PUSH=true TAG=latest image-talos-backup

Directories

Path Synopsis
cmd
talos-backup
Package main provides the command line interface for talos-backup.
Package main provides the command line interface for talos-backup.
talos-backup/service
Package service provides methods for the etcd snapshot service.
Package service provides methods for the etcd snapshot service.
pkg
config
Package config provides functions for parsing the backup configs
Package config provides functions for parsing the backup configs
encryption
Package encryption provides methods for encrypting backups.
Package encryption provides methods for encrypting backups.
s3
Package s3 provides functions for pushing a file to s3
Package s3 provides functions for pushing a file to s3
talos
Package talos provides functions for connecting to and taking snapshots from a given talos cluster
Package talos provides functions for connecting to and taking snapshots from a given talos cluster
util
Package util provides utility methods.
Package util provides utility methods.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL