Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
61 lines (57 sloc) 1.36 KB
apiVersion: v1
kind: ServiceAccount
metadata:
name: gitlab-backup
namespace: gitlab
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: gitlab
name: gitlab-backup
rules:
- apiGroups: [""]
resources:
- pods
- pods/exec
- services
verbs: ["get", "list", "watch", "create", "patch", "update", "delete", "exec"]
- apiGroups: ["extensions", "apps"]
resources:
- deployments
verbs: ["get", "list", "watch", "create", "patch", "delete"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: gitlab-backup
namespace: gitlab
subjects:
- kind: ServiceAccount
name: gitlab-backup
namespace: gitlab
roleRef:
kind: Role
name: gitlab-backup
apiGroup: rbac.authorization.k8s.io
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: gitlab-backup
namespace: gitlab
spec:
schedule: "00 13-20 * * 1-5"
jobTemplate:
spec:
template:
spec:
serviceAccountName: gitlab-backup
containers:
- name: gitlab-backup
image: bitnami/kubectl:latest
command:
- /bin/sh
- -c
- kubectl exec $(kubectl get pods -l release=gitlab,app=task-runner -n gitlab -o jsonpath="{.items[0].metadata.name}") -it backup-utility -n gitlab
restartPolicy: OnFailure
You can’t perform that action at this time.