Skip to content

Instantly share code, notes, and snippets.

@thikade
Forked from dmc5179/etcd-backup-cron.yaml
Created April 2, 2021 22:43
Show Gist options
  • Save thikade/c9c3094760314869c8e5797ff9ceeb42 to your computer and use it in GitHub Desktop.
Save thikade/c9c3094760314869c8e5797ff9ceeb42 to your computer and use it in GitHub Desktop.
OpenShift Cron job to backup etcd database
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: etcd-backup
spec:
schedule: "0 0 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: etcd-backup
#image: quay.io/danclark/etcd-backup:latest
image: registry.redhat.io/rhel7/rhel-tools:latest
imagePullPolicy: Always
args:
- /bin/sh
- -c
- chroot /host /usr/local/bin/cluster-backup.sh /home/core/assets/backup
securityContext:
privileged: true
runAsUser: 0
volumeMounts:
- mountPath: /host
name: host
restartPolicy: OnFailure
dnsPolicy: ClusterFirst
enableServiceLinks: true
hostNetwork: true
hostPID: true
securityContext: {}
serviceAccount: default
serviceAccountName: default
tolerations:
- operator: Exists
nodeSelector:
node-role.kubernetes.io/master: ''
volumes:
- hostPath:
path: /
type: Directory
name: host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment