Created
April 27, 2020 15:26
-
-
Save sebastien-prudhomme/c53e870dc6b4987fefa4c36ea9f1187c to your computer and use it in GitHub Desktop.
Kubernetes volume snapshot-based backup with Stash and Argo
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: stash.appscode.com/v1beta1 | |
kind: BackupConfiguration | |
metadata: | |
name: mongodb | |
spec: | |
schedule: "0 23 * * 0" | |
paused: true | |
driver: VolumeSnapshotter | |
target: | |
ref: | |
apiVersion: apps/v1 | |
kind: Deployment | |
name: mongodb | |
snapshotClassName: scw-snapshot | |
retentionPolicy: | |
name: mongodb | |
keepLast: 5 | |
prune: true |
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: argoproj.io/v1alpha1 | |
kind: CronWorkflow | |
metadata: | |
name: mongodb-backup | |
spec: | |
schedule: "0 23 * * 0" | |
suspend: false | |
concurrencyPolicy: Forbid | |
workflowSpec: | |
entrypoint: mongodb-backup | |
activeDeadlineSeconds: 3600 | |
templates: | |
- name: mongodb-backup | |
serviceAccountName: mongodb-backup | |
resource: | |
action: create | |
manifest: | | |
apiVersion: stash.appscode.com/v1beta1 | |
kind: BackupSession | |
metadata: | |
generateName: mongodb- | |
spec: | |
invoker: | |
apiGroup: stash.appscode.com | |
kind: BackupConfiguration | |
name: mongodb | |
successCondition: status.phase == Succeeded | |
failureCondition: status.phase == Failed | |
metrics: | |
prometheus: | |
- name: backup_duration_seconds | |
help: Duration of the backup in seconds | |
gauge: | |
value: "{{duration}}" | |
labels: | |
- key: application | |
value: mongodb |
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: rbac.authorization.k8s.io/v1 | |
kind: Role | |
metadata: | |
name: mongodb-backup | |
rules: | |
- apiGroups: | |
- stash.appscode.com | |
resources: | |
- backupsessions | |
verbs: | |
- create | |
- get |
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: rbac.authorization.k8s.io/v1 | |
kind: RoleBinding | |
metadata: | |
name: mongodb-backup | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: Role | |
name: mongodb-backup | |
subjects: | |
- kind: ServiceAccount | |
name: mongodb-backup | |
namespace: default |
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: v1 | |
kind: ServiceAccount | |
metadata: | |
name: mongodb-backup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment