1

我指定:

这是部署:

apiVersion: apps/v1beta1
kind: Deployment
         ...
          volumeMounts:
            - name: volumepath
              mountPath: /data
          ports:
            - containerPort: 9200
              name: http
              protocol: TCP
      volumes:
        - name: volumepath
          persistentVolumeClaim:
          claimName: pv-delay-bind

这是持久卷:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-delay-bind
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 10Gi
  hostPath:
    path: /data/
    type: DirectoryOrCreate
  storageClassName: default1a
4

1 回答 1

1

持久卷不同于持久卷声明。通常,当您使用持久卷声明时,您使用的是动态配置。

因此,您需要首先定义持久卷声明,并且应该自动创建卷。

首先,如果不需要,请删除您的卷。

$ kubectl delete volume pv-delay-bind

然后创建声明:

$ echo '
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pv-delay-bind
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 10Gi
  storageClassName: default1a' | kubectl apply -f - 
于 2019-09-04T02:33:54.090 回答