apiVersion: apps/v1 kind: Deployment metadata: name: redis labels: app: redis spec: replicas: 1 selector: matchLabels: app: redis template: metadata: labels: app: redis spec: containers: - name: redis image: redis:latest ports: - containerPort: 6379 volumeMounts: - name: redis-data mountPath: /data - name: redis-config mountPath: /usr/local/etc/redis/redis.conf subPath: redis.conf command: ["redis-server", "/usr/local/etc/redis/redis.conf"] volumes: - name: redis-data nfs: server: 10.3.202.100 path: /root/data/nfs/redis/data - name: redis-config configMap: name: redis-config --- apiVersion: v1 kind: Service metadata: name: redis-service spec: selector: app: redis type: ClusterIP ports: - protocol: TCP port: 6379 targetPort: 6379 --- apiVersion: v1 kind: ConfigMap metadata: name: redis-config data: redis.conf: | appendonly yes save 3600 1 aof-use-rdb-preamble yes