Skip to content

Instantly share code, notes, and snippets.

@davoult
Forked from dmc5179/etcd-backup-cron.yaml
Last active March 2, 2022 10:59
Show Gist options
  • Save davoult/9aefaa3e2a165aaced5fed58bf76309f to your computer and use it in GitHub Desktop.
Save davoult/9aefaa3e2a165aaced5fed58bf76309f 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
namespace: openshift-etcd
spec:
schedule: '@daily'
jobTemplate:
spec:
template:
spec:
containers:
- name: etcd-backup
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