Skip to content

k8up

Install from the command line:
Learn more
$ docker pull ghcr.io/k8up-io/k8up:master

Recent tagged image versions

  • Published about 8 hours ago · Digest
    sha256:d17ca68ea6094fa3f75675f665b69bc0831bfd61fac79a94202dd0106685e72c
    0
  • Published about 24 hours ago · Digest
    sha256:4e6b7c7130ac3bb7df46b81e9daaee080da7cb1df21c5cc80d27eefbdbe5cd08
    1,577
  • Published about 24 hours ago · Digest
    sha256:db1485384e4b2923e3e8638402d57dd656ccfd28a72c2d0d1aa319a2bea8add2
    3
  • Published about 24 hours ago · Digest
    sha256:0f44acac65b3e2fad269ec55959a949deac3d22fc6eaef562cfccd02682adea1
    144
  • Published 27 days ago · Digest
    sha256:a62905646f2f462c7ef8a64c10135ac5a57e00b660fd8c3ba3c5d2e567aeef50
    1,003

Build Go version Kubernetes version Version Maintainability GitHub downloads License CII Best Practices

K8up logo

K8up Backup Operator

K8up is a Kubernetes backup operator based on Restic that will handle PVC and application backups on a Kubernetes or OpenShift cluster.

Just create a schedule and a credentials object in the namespace you’d like to backup. It’s that easy. K8up takes care of the rest. It also provides a Prometheus endpoint for monitoring.

Documentation

The documentation is written in AsciiDoc and published with Antora to k8up.io. It's source is available in the docs/ directory.

Contributing

K8up is written using Kubebuilder.

You'll need:

  • A running Kubernetes cluster (minishift, minikube, k3s, ... you name it)
  • kubectl and kustomize
  • Go development environment
  • Your favorite IDE (with a Go plugin)
  • Docker
  • make

To run the end-to-end test (e.g. make e2e-test), you additionally need:

  • helm (version 3)
  • jq
  • node and npm
  • bash (installed, doesn't have to be your default shell)
  • shasum or sha1sum
  • base64
  • find

These are the most common make targets: build, test, docker-build, run, kind-run. Run make help to get an overview over the relevant targets and their intentions.

Code Structure

K8s consists of two main modules:

  • The operator module is the part that runs constantly within K8s and contains the various reconciliation loops.
  • The restic module is our interface to the restic binary and is invoked whenever a Backup or Restore (or similar) custom resource is instantiated. If it's job (like doing a backup or a restore) is done, the process ends.
/
- api           Go Types for the Custom Resource Definitions (CRDs) [o]
- cmd           CLI definition and entrypoints
- common        Code that is not specific to either
- config        Various configuration files for the Operator SDK [o]
- controllers   The reconciliation loops of the operator module [o]
- docs          Out ASCIIdoc code as published on https://k8up.io
- e2e           The Bats-based End-To-End tests
- envtest       Infrastructure code for the integration tests
- operator      Code that is otherwise related to the _operator module_,
                but not part of the recommended Operator SDK structure.
- restic        Code that makes up the _restic module_.

[o]: this is part of the recommended Operator SDK structure

Generate Kubernetes code

If you make changes to the CRD structs you'll need to run code generation. This can be done with make:

make generate

Install CRDs

CRDs can be either installed on the cluster by running make install or using kubectl apply -k config/crd/apiextensions.k8s.io/v1.

Currently there's an issue using make install related to how the CRDs are specified. Therefore settle to the second approach for now.

Run the operator

You can run the operator in different ways:

  1. as a container image (see quickstart)
  2. using make run-operator (provide your own kubeconfig)
  3. using make kind-run (uses KIND to install a cluster in docker and provides its own kubeconfig in testbin/)
  4. using a configuration of your favorite IDE

Best is if you have minio installed somewhere to be able to setup the needed env values. It needs to be reachable from within your dev cluster.

Run E2E tests

You need node and npm to run the tests, as it runs with DETIK.

To run e2e tests, execute:

make e2e-test

To test just a specific e2e test, run:

make e2e-test -e BATS_FILES=test-00-deployment.bats

To remove the local KIND cluster and other e2e resources, run:

make e2e-clean

To cleanup all created artifacts, there's always:

make clean

Example configurations

There are a number of example configurations in config/samples. Apply them using kubectl apply -f config/samples/somesample.yaml

Details


Last published

8 hours ago

Discussions

8

Issues

37

Total downloads

5.95K


Collaborators 5