Created
March 25, 2021 03:01
-
-
Save dmc5179/ed7285c5f7d67a5575e5414251d09662 to your computer and use it in GitHub Desktop.
etcd backup kubecron to S3
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/v1beta1 | |
kind: CronJob | |
metadata: | |
name: etcd-backup | |
spec: | |
schedule: "*/1 * * * *" | |
jobTemplate: | |
spec: | |
template: | |
spec: | |
containers: | |
- name: etcd-backup | |
image: docker.io/amazon/aws-cli | |
imagePullPolicy: IfNotPresent | |
command: ["/bin/sh"] | |
args: | |
- -c | |
- 'chroot /host /usr/local/bin/cluster-backup.sh /home/core/assets/backup && aws s3 sync /host/home/core/assets/backup/ "s3://${BUCKET_NAME}/${BUCKET_PATH}/"' | |
securityContext: | |
privileged: true | |
runAsUser: 0 | |
env: | |
- name: AWS_ACCESS_KEY_ID | |
valueFrom: | |
secretKeyRef: | |
name: aws-creds | |
key: aws_access_key_id | |
- name: AWS_SECRET_ACCESS_KEY | |
valueFrom: | |
secretKeyRef: | |
name: aws-creds | |
key: aws_secret_access_key | |
- name: AWS_DEFAULT_REGION | |
value: "us-east-1" | |
- name: BUCKET_NAME | |
value: 'mybucket' | |
- name: BUCKET_PATH | |
value: "etcd" | |
volumeMounts: | |
- name: host | |
mountPath: /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: | |
- name: host | |
hostPath: | |
path: / | |
type: Directory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment