Explorar el Código

Adding backup pod, job and cronjob manifests

bodicsek hace 1 año
padre
commit
a45dd17961
Se han modificado 3 ficheros con 89 adiciones y 0 borrados
  1. 32 0
      backup.cronjob.yaml
  2. 29 0
      backup.job.yaml
  3. 28 0
      backup.pod.yaml

+ 32 - 0
backup.cronjob.yaml

@@ -0,0 +1,32 @@
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+  name: backup
+spec:
+  schedule: "30 3 * * 1,3,5"
+  jobTemplate:
+    spec:
+      template:
+        spec:
+          containers:
+          - args: ["backup", "--repo", "/data/repo", "--insecure-no-password", "/data/glusterfs"]
+            image: restic/restic:0.17.2
+            imagePullPolicy: IfNotPresent
+            name: restic
+            volumeMounts:
+              - name: restic-repo-vol
+                mountPath: /data/repo
+              - name: backup-data-vol
+                mountPath: /data/glusterfs
+          volumes:
+          - name: restic-repo-vol
+            hostPath:
+              path: /data/backup
+              type: Directory
+          - name: backup-data-vol
+            hostPath:
+              path: /mnt
+              type: Directory
+          restartPolicy: Never
+          nodeSelector:
+            kubernetes.io/hostname: raspberrypi4

+ 29 - 0
backup.job.yaml

@@ -0,0 +1,29 @@
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: backup
+spec:
+  template:
+    spec:
+      containers:
+      - args: ["backup", "--repo", "/data/repo", "--insecure-no-password", "/data/glusterfs"]
+        image: restic/restic:0.17.2
+        imagePullPolicy: IfNotPresent
+        name: restic
+        volumeMounts:
+          - name: restic-repo-vol
+            mountPath: /data/repo
+          - name: backup-data-vol
+            mountPath: /data/glusterfs
+      volumes:
+      - name: restic-repo-vol
+        hostPath:
+          path: /data/backup
+          type: Directory
+      - name: backup-data-vol
+        hostPath:
+          path: /mnt
+          type: Directory
+      restartPolicy: Never
+      nodeSelector:
+        kubernetes.io/hostname: raspberrypi4

+ 28 - 0
backup.pod.yaml

@@ -0,0 +1,28 @@
+apiVersion: v1
+kind: Pod
+metadata:
+  name: restic-cli
+spec:
+  containers:
+  - command: ["/bin/sleep"]
+    args: ["infinity"]
+    image: restic/restic:0.17.2
+    imagePullPolicy: IfNotPresent
+    name: restic-cli
+    volumeMounts:
+      - name: restic-repo-vol
+        mountPath: /data/repo
+      - name: backup-data-vol
+        mountPath: /data/glusterfs
+  volumes:
+  - name: restic-repo-vol
+    hostPath:
+      path: /data/backup
+      type: Directory
+  - name: backup-data-vol
+    hostPath:
+      path: /mnt
+      type: Directory
+  restartPolicy: Never
+  nodeSelector:
+    kubernetes.io/hostname: raspberrypi4