Created
July 2, 2020 11:14
-
-
Save velotiotech/57cb0774508f0594e97efbcc2d9f3f82 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`apiVersion: batch/v1beta1kind: CronJobmetadata: name: backup namespace: kube-systemspec: # activeDeadlineSeconds: 100schedule: "*/1 * * * *" | |
jobTemplate: | |
spec: | |
template: | |
spec: | |
containers: | |
- name: backup | |
# Same image as in /etc/kubernetes/manifests/etcd.yaml | |
image: k8s.gcr.io/etcd:3.2.24 | |
env: | |
- name: ETCDCTL_API | |
value: "3" | |
command: ["/bin/sh"] | |
args: ["-c", "etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt --key=/etc/kubernetes/pki/etcd/healthcheck-client.key snapshot save /backup/etcd-snapshot-$(date +%Y-%m-%d_%H:%M:%S_%Z).db"] | |
volumeMounts: | |
- mountPath: /etc/kubernetes/pki/etcd | |
name: etcd-certs | |
readOnly: true | |
- mountPath: /backup | |
name: backup | |
restartPolicy: OnFailure | |
hostNetwork: true | |
volumes: | |
- name: etcd-certs | |
hostPath: | |
path: /etc/kubernetes/pki/etcd | |
type: DirectoryOrCreate | |
- name: backup | |
hostPath: | |
path: /data/backup | |
type: DirectoryOrCreate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment