5

I'd like to schedule this command line to run every 12h on Google Container Engine:

gcloud compute --project "qvitoo-com" disks snapshot \
  "SPECIFIC_INSTANCE_ID" --zone "europe-west1-c" --snapshot-names \
  "DB-staging-$(date -u +"%Y-%m-%dT%H-%M-%SZ")"

We're running hosted Kubernetes.

This command line needs access to the gcloud API to succeed. How do I make this happen?

(I can't use gcloud cron because it's HTTP calls only, and Kubernetes cron jobs are in alpha, plus I don't know how to authenticate)

Henrik
  • 386
  • 2
  • 4
  • 13

3 Answers3

7

Our solution is built on an open source tool called k8s-snapshots. This toll requires the use of PersistentVolumes but with annotations performs a snapshot at an interval. It also manages retention. Our extension to it notifies via slack if that's useful to you. It runs as a separate service inside our k8s cluster and uses the authentication that's native on the GCE host the cluster is running on.

Chester Husk
  • 171
  • 1
2

Another option is snapshot-controller. It's similar to k8s-snapshots, but has fewer fancy features. I couldn't get k8s-snapshots to work due to this bug.

Echo Nolan
  • 138
  • 6
1

Take a look here: https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver (beta on k8s 1.13) It support snapshot and restore as k8s resource.

Giorgio C
  • 11
  • 1