代码之家  ›  专栏  ›  技术社区  ›  Chris Stryczynski

如何在pod中装载持久卷?

  •  0
  • Chris Stryczynski  · 技术社区  · 7 年前

    如何装载持久卷?如何引用它?

    这里有一个pod配置:

    kind: Pod
    apiVersion: v1
    metadata:
      name: task-pv-pod
    spec:
      volumes:
        - name: task-pv-storage
          persistentVolumeClaim:
           claimName: task-pv-claim
      containers:
        - name: task-pv-container
          image: nginx
          ports:
            - containerPort: 80
              name: "http-server"
    
    1 回复  |  直到 7 年前
        1
  •  0
  •   Chris Stryczynski    7 年前

    摘自: https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/#create-a-pod

    kind: Pod
    apiVersion: v1
    metadata:
      name: task-pv-pod
    spec:
      volumes:
        - name: task-pv-storage
          persistentVolumeClaim:
           claimName: task-pv-claim
      containers:
        - name: task-pv-container
          image: nginx
          ports:
            - containerPort: 80
              name: "http-server"
          volumeMounts:
            - mountPath: "/usr/share/nginx/html"
              name: task-pv-storage
    
    推荐文章