k8s.aws-backup.yaml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. ---
  2. apiVersion: v1
  3. kind: PersistentVolume
  4. metadata:
  5. name: source
  6. spec:
  7. capacity:
  8. storage: 5Mi
  9. volumeMode: Filesystem
  10. accessModes:
  11. - ReadWriteOnce
  12. persistentVolumeReclaimPolicy: Retain # Keep 4eva
  13. storageClassName: default
  14. mountOptions:
  15. - hard
  16. - nfsvers=3
  17. nfs:
  18. path: /mnt/DroboFS/Shares/Public/important
  19. server: 10.42.42.10
  20. claimRef:
  21. name: source
  22. namespace: default
  23. ---
  24. apiVersion: v1
  25. kind: PersistentVolumeClaim
  26. metadata:
  27. name: source
  28. annotations:
  29. nfs.io/storage-path: "source"
  30. spec:
  31. storageClassName: default
  32. accessModes:
  33. - ReadWriteOnce
  34. resources:
  35. requests:
  36. storage: 5Mi
  37. status: {}
  38. ---
  39. apiVersion: v1
  40. kind: PersistentVolume
  41. metadata:
  42. name: aws-backup
  43. spec:
  44. capacity:
  45. storage: 5Mi
  46. volumeMode: Filesystem
  47. accessModes:
  48. - ReadWriteOnce
  49. persistentVolumeReclaimPolicy: Retain # Keep 4eva
  50. storageClassName: default
  51. mountOptions:
  52. - hard
  53. - nfsvers=3
  54. nfs:
  55. path: /mnt/DroboFS/Shares/Kubernetes/volumes/static/aws-backup
  56. server: 10.42.42.10
  57. claimRef:
  58. name: aws-backup
  59. namespace: default
  60. ---
  61. apiVersion: v1
  62. kind: PersistentVolumeClaim
  63. metadata:
  64. name: aws-backup
  65. annotations:
  66. nfs.io/storage-path: "aws-backup"
  67. spec:
  68. storageClassName: default
  69. accessModes:
  70. - ReadWriteOnce
  71. resources:
  72. requests:
  73. storage: 5Mi
  74. status: {}
  75. ---
  76. apiVersion: batch/v1
  77. kind: CronJob
  78. metadata:
  79. name: cron-aws-backup
  80. spec:
  81. schedule: "@daily"
  82. concurrencyPolicy: Forbid
  83. # Start up to 8 hours late
  84. startingDeadlineSeconds: 28800
  85. jobTemplate:
  86. spec:
  87. ttlSecondsAfterFinished: 28800
  88. backoffLimit: 4
  89. template:
  90. spec:
  91. containers:
  92. - name: cron-aws-backup
  93. image: fdamstra/aws-backup
  94. env:
  95. - name: AWS_DEFAULT_REGION
  96. value: us-east-2
  97. - name: DEST_S3
  98. value: s3://backups.monkeybox.org/io/important/
  99. envFrom:
  100. - secretRef:
  101. name: aws-creds
  102. volumeMounts:
  103. - name: aws-backup
  104. mountPath: /scratch/
  105. - name: source
  106. mountPath: /source/
  107. dnsPolicy: "None"
  108. dnsConfig:
  109. nameservers:
  110. - 10.42.42.239
  111. - 10.42.42.1
  112. searches:
  113. - default.svc.cluster.local
  114. - svc.cluster.local
  115. - cluster.local
  116. options:
  117. - name: ndots
  118. value: "2"
  119. - name: edns0
  120. - name: trust-ad
  121. restartPolicy: Never
  122. volumes:
  123. - name: aws-backup
  124. persistentVolumeClaim:
  125. claimName: aws-backup
  126. - name: source
  127. persistentVolumeClaim:
  128. claimName: source