katafygio

command module
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2018 License: MIT Imports: 3 Imported by: 0

README

katafygio

Build Status Coverage Status Go Report Card

katafygio discovers Kubernetes objects (deployments, services, ...), and continuously save them as yaml files in a git repository. This provides real time, continuous backups, and keeps detailled changes history.

Usage

To dump the cluster content once and exit:

katafygio --no-git --dump-only --local-dir /tmp/clusterdump/

To create a local git repository and continuously save the cluster content:

katafygio --local-dir /tmp/kfdump

Same, but also continuously push to a remote repository:

katafygio --git-url https://user:token@github.com/myorg/myrepos.git --local-dir /tmp/kfdump

Filtering out irrelevant objects (esp. ReplicaSets and Pods) with -x or -y will help to keep resources usage low, and a concise git history. Eg.:

# Filtering out replicasets and pods since they are generated by Deployments
# (already archived), endpoints (managed by Services), secrets (to keep them
# confidential), events and node (irrelevant), and the leader-elector
# configmap that has low value and changes a lot, causing commits churn.

katafygio \
  -g https://user:token@github.com/myorg/myrepos.git -e /tmp/kfdump \
  -x secret -x pod -x replicaset -x node -x endpoints -x event \
  -y configmap:kube-system/leader-elector

You can also use the docker image.

CLI options

Backup Kubernetes cluster as yaml files in a git repository.
--exclude-kind (-x) and --exclude-object (-y) may be specified several times.

Usage:
  katafygio [flags]
  katafygio [command]

Available Commands:
  help        Help about any command
  version     Print the version number

Flags:
  -s, --api-server string        Kubernetes api-server url
  -c, --config string            Configuration file (default "/etc/katafygio/katafygio.yaml")
  -d, --dry-run                  Dry-run mode: don't store anything
  -m, --dump-only                Dump mode: dump everything once and exit
  -x, --exclude-kind strings     Ressource kind to exclude. Eg. 'deployment'
  -y, --exclude-object strings   Object to exclude. Eg. 'configmap:kube-system/kube-dns'
  -l, --filter string            Label filter. Select only objects matching the label
  -g, --git-url string           Git repository URL
  -p, --healthcheck-port int     Port for answering healthchecks on /health url
  -h, --help                     help for katafygio
  -k, --kube-config string       Kubernetes config path
  -e, --local-dir string         Where to dump yaml files (default "./kubernetes-backup")
  -v, --log-level string         Log level (default "info")
  -o, --log-output string        Log output (default "stderr")
  -r, --log-server string        Log server (if using syslog)
  -n, --no-git                   Don't version with git
  -i, --resync-interval int      Full resync interval in seconds (0 to disable) (default 900)

Config file and env variables

All settings can be passed by command line options, or environment variable, or in a yaml configuration file (thanks to Viper and Cobra libs). The environment are the same as cli options, in uppercase, prefixed by "KF", and with underscore instead of dashs. ie.:

export KF_GIT_URL=https://user:token@github.com/myorg/myrepos.git
export KF_LOCAL_DIR=/tmp/kfdump
export KF_LOG_LEVEL=info

# exception, for kubectl compatibility:
export KUBECONFIG=/tmp/kconfig

Installation

You can find pre-built binaries in the releases page, ready to run on your desktop or in a cluster.

We also provide a docker image.

On MacOs, you can use the brew formula:

brew install bpineau/tap/katafygio

You can also deploy with the provided helm chart:

helm install --name kf-backups --namespace kube-system assets/helm-chart/katafygio/

If you want to build from sources, assuming you have go 1.10 and glide in the path, and GOPATH configured:

make deps
make build

See Also

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
client
Package client initialize and wrap a Kubernete's client-go rest.Config client
Package client initialize and wrap a Kubernete's client-go rest.Config client
controller
Package controller list and keep watching a specific Kubernetes resource kind (ie.
Package controller list and keep watching a specific Kubernetes resource kind (ie.
event
Package event mediates notification between controllers and recorder
Package event mediates notification between controllers and recorder
health
Package health serves health checks over HTTP at /health endpoint.
Package health serves health checks over HTTP at /health endpoint.
log
Package log initialize and configure a logrus logger.
Package log initialize and configure a logrus logger.
observer
Package observer polls the Kubernetes api-server to discover all supported API groups/object kinds, and launch a new controller for each of them.
Package observer polls the Kubernetes api-server to discover all supported API groups/object kinds, and launch a new controller for each of them.
recorder
Package recorder listen for event notifications from controllers, and persists those events' content as files on disk.
Package recorder listen for event notifications from controllers, and persists those events' content as files on disk.
store/git
Package git makes a git repository out of a local directory, keeps the content committed when the directory content changes, and optionaly (if a remote repos url is provided), keep it in sync with a remote repository.
Package git makes a git repository out of a local directory, keeps the content committed when the directory content changes, and optionaly (if a remote repos url is provided), keep it in sync with a remote repository.

Jump to

Keyboard shortcuts

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