Kubernetes resource backup and exporter. kubbck
relies on kubectl
to export kubernetes resources from one or more clusters. The exported resources are stored as yaml
files on the filesystem.
The easiest and best way of running kubebck is by using Docker
. You need to provide a kubeconfig
file to the container as well as a storage area for the exported data. We can use a volume mount for this.
docker run \
-d --privileged \
-v /var/lib/kubebck/data/:/kubebck \
-v /var/lib/kubebck/config:/config \
amimof/kubebck:latest
This example will connect to the Kubernetes clusters using the contexts defined in the provided kubeconfig file and store exported data to /var/lib/kubebck/data
on the container host. After the kubebck container is finished backing up all clusters, the container will terminate and the content of the output directory will look something like this.
├── minikube
| ├── 2019-03-21
| | ├── clusterrolebindings.yaml
| | ├── clusterroles.yaml
...
| | ├── groups.yaml
| | ├── namespaces
| | │ ├── default
| | | | ├── configmaps.yaml
| | | | ├── deployments.yaml
| | | | ├── pods.yaml
...
| | | | └── statefulsets.yaml
| | | ├── kube-public
| | │ └── kube-system
| | ├── namespaces.yaml
| | ├── nodes.yaml
...
| | └── persistentvolumes.yaml
| ├── 2019-04-09
...
├── minishift
| ├── 2019-03-21
...
There are a few options you may set using environment variables if the default values do not apply for you.
Name | Default | Description |
---|---|---|
KUBEBCK_OUTPUT_DIR |
/kubebck |
A path to the root directory in which the exported data will be stored. |
KUBEBCK_OUTOUT_FORMAT |
yaml |
Output format of the exported files. Can be either yaml or json . |
KUBEBCK_ARCHIVE |
false |
If set tot true , exported data will be added to a tar archive and the original exported data will be remove. |
All help in any form is highly appreciated and your are welcome participate in developing together. To contribute submit a Pull Request. If you want to provide feedback, open up a Github Issue or contact me personally.