Taking snapshots for Docker containers running in Kubernetes.
This is a rewritten of qiniu-ava/snapshot-operator, and is inspired by wulibin163/kubepush.
- The operator starts a worker. To communicate to the docker daemon runs the target container, the worker is configured to run on the same node of the target container.
- The worker behaves as running docker committo take a snapshot (as a new docker image) for the target container, and
- running docker pushto push the snapshot image.
- 
preparation: - 
create CRD: kubectl apply -f ./deploy/crds/atom.supremind.com_containersnapshots_crd.yaml
- 
deploy operator: kubectl apply -f ./deploy
 
- 
- 
use a ContainerSnapshot - 
create a pod and make sure it is running: kubectl apply -f example/pod.yaml
- 
create an image push secret The easies way to do this is creating one based on existing Docker credentials, more options could be found in the same page. 
- 
create a ContainerSnapshot CR: kubectl apply -f example/containersnapshot.yamlyou may need to change the imagePushSecrets.nameto your secret name, and theimageto a repository you have write access to
 
- 
- 
check to see the worker pod starts and ends: kubectl get po -w
- 
validate the generated snapshot image contains target container's read/write layer: docker run --rm my-snapshots/example-snapshot:v0.0.1 -- cat /dates
- set worker pod template when start the operator
- set worker pod template in containerSnapshot spec