Skip to content

Instantly share code, notes, and snippets.

@dmc5179
Created March 2, 2021 02:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save dmc5179/76100b59d6c75a2f8f8ee34b922f5d1f to your computer and use it in GitHub Desktop.
Save dmc5179/76100b59d6c75a2f8f8ee34b922f5d1f 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