persistentvolumeclaim "pv-delay-bind" 未找到 kubernetes
persistentvolumeclaim "pv-delay-bind" not found kubernetes
我指定:
这是部署:
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
一个 Persistent Volume is different from a Persistent Volume Claim. Typically, when you use persistent volume claim you are using dynamic 配置。
因此您需要先定义持久卷声明,然后卷应该自动创建。
首先,如果不需要,请删除您的卷。
$ 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 -
我指定:
这是部署:
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
一个 Persistent Volume is different from a Persistent Volume Claim. Typically, when you use persistent volume claim you are using dynamic 配置。
因此您需要先定义持久卷声明,然后卷应该自动创建。
首先,如果不需要,请删除您的卷。
$ 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 -