Last active
July 16, 2019 13:15
-
-
Save cuongtransc/4f394e313394a94d797efbc341809c35 to your computer and use it in GitHub Desktop.
Kubernetes CronJob: GitLab Backup
This file contains hidden or 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
# Author: Cuong Tran | |
# | |
# Build: docker build -t cuongtransc/kubectl:1.9.1 . | |
# Run: docker run -it --rm cuongtransc/kubectl:1.9.1 sh | |
# | |
FROM roffe/kubectl:v1.9.1 | |
COPY kube_config /root/.kube |
This file contains hidden or 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/v2alpha1 | |
kind: CronJob | |
metadata: | |
name: gitlab-backup | |
spec: | |
schedule: "0 0 * * *" | |
jobTemplate: | |
spec: | |
template: | |
spec: | |
containers: | |
- name: gitlab-backup | |
image: 112412312.dkr.ecr.ap-southeast-1.amazonaws.com/sero-kubectl:1.9.1 | |
args: | |
- /bin/sh | |
- -c | |
- kubectl exec --namespace=default -it `kubectl get po -n default | egrep -o "sero-git-gitlab[a-zA-Z0-9-]+" | head -n 1` gitlab-rake gitlab:backup:create | |
restartPolicy: OnFailure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment