123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- apiVersion: apps/v1
- kind: Deployment
- metadata:
- name: redis
- labels:
- name: redis
- spec:
- replicas: 1
- selector:
- matchLabels:
- name: redis
- template:
- metadata:
- name: redis
- labels:
- name: redis
- spec:
- containers:
- - name: redis
- image: redis:alpine
- args: ["--requirepass", "$(REDISCLI_AUTH)"]
- livenessProbe:
- exec:
- command: ["redis-cli", "PING"]
- initialDelaySeconds: 120
- periodSeconds: 60
- env:
- - name: REDISCLI_AUTH
- valueFrom:
- secretKeyRef:
- key: root-password
- name: redis
- lifecycle:
- preStop:
- exec:
- command: ["redis-cli", "SHUTDOWN SAVE"]
- ports:
- - containerPort: 6379
- name: redis
- protocol: TCP
- resources:
- requests:
- memory: "100Mi"
- cpu: "10m"
- volumeMounts:
- - mountPath: /data
- name: redis-pv
- volumes:
- - name: redis-pv
- persistentVolumeClaim:
- claimName: redis-pvc
- ---
- apiVersion: batch/v1
- kind: CronJob
- metadata:
- name: redis-backup
- spec:
- schedule: "@daily"
- jobTemplate:
- spec:
- template:
- spec:
- containers:
- - name: redis-backup
- image: qdii/backup-ssh:latest
- env:
- - name: REDISCLI_AUTH
- valueFrom:
- secretKeyRef:
- key: root-password
- name: redis
- - name: BCK_USERNAME
- value: "uab10c1ba4bc"
- - name: BCK_HOSTNAME
- value: "bck.dodges.it"
- - name: BCK_FOLDER
- value: "/home/uab10c1ba4bc/data/vol0/redis"
- volumeMounts:
- - name: redis-config
- mountPath: "/root/backup.sh"
- subPath: backup.sh
- readOnly: true
- - name: backup
- mountPath: "/root/.ssh/id_rsa"
- subPath: ssh_private_key
- readOnly: true
- - name: backup
- mountPath: "/root/.ssh/id_rsa.pub"
- subPath: ssh_public_key
- readOnly: true
- command: ["/root/backup.sh"]
- restartPolicy: Never
- volumes:
- - name: redis-config
- configMap:
- name: redis
- defaultMode: 0500
- - name: backup
- secret:
- secretName: backup
- defaultMode: 0400
|