apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
  namespace: oasis
  name: redis-cluster-node-ns
spec:
  serviceName: "redis-cluster-svc"
  template:
    spec:     
      containers:
        volumeMounts:
        - name: sys-time
          mountPath: /etc/localtime
        - name: redisdata
          mountPath: /home/redis    # pod中docker容器目录,即要被挂载的目录
      volumes:
      - name: sys-time
        hostPath:
          path: /etc/localtime
      - name: redisdata    # 对应前面的volumeMounts name
        hostPath:
          path: /root/redis    # 本地host目录,即挂载目录

 

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐