我从helm stable chart安装elasticsearch,现在卡在了pvc到pc。
我已经创建了一个与helm elastic的PVC相同标签的PC。
PVC:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
finalizers:
- kubernetes.io/pvc-protection
labels:
app: elasticsearch
component: data
release: es
role: data
name: data-es-elasticsearch-data-0
selfLink: /api/v1/namespaces/default/persistentvolumeclaims/data-es-elasticsearch-data-0
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
volumeMode: Filesystem
status: {}
PV:
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"PersistentVolume","metadata":{"annotations":{},"labels":{"type":"local"},"name":"task-pv-volume"},"spec":{"accessModes":["ReadWriteOnce"],"capacity":{"storage":"15Gi"},"hostPath":{"path":"/app/k8s-volumes"},"storageClassName":"manual"}}
creationTimestamp: null
finalizers:
- kubernetes.io/pv-protection
labels:
app: elasticsearch
component: data
release: es
role: data
type: local
name: task-pv-volume
selfLink: /api/v1/persistentvolumes/task-pv-volume
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 15Gi
hostPath:
path: /app/k8s-volumes
type: ""
persistentVolumeReclaimPolicy: Retain
storageClassName: manual
volumeMode: Filesystem
status: {}
怎么样将这种pvc绑定到pv?
PersistentVolumeClaim
和PersistentVolume
(不是标签)必须匹配。你的PVC没有
storageClassName
,因此将PV更改为storageClassName:''
应该就可以了。确认有效,谢谢大神。
如果你手动创建PV,我猜你没有使用存储类。 但是你要在PV中定义一个存储类。 因此,你可以尝试在没有storageClassName字段的情况下重新创建PV:
apiVersion: v1 kind: PersistentVolume metadata: name: task-pv-volume spec: accessModes: - ReadWriteOnce capacity: storage: 15Gi hostPath: path: /app/k8s-volumes type: "" persistentVolumeReclaimPolicy: Retain volumeMode: Filesystem
谢谢,也可以。
你的答案