在使用pv卷的时候pod启动报错pod has unbound immediate PersistentVolumeClaims
这个报错是因为pvc没有和pv关联起来,我这边的PVC是创建pod的时候自动创建的,可以手动把pv和PVC关联或者创建StorageClass让pv和PVC自动关联
我这边是修改yaml手动关联解决的
在pv的yaml文件添加如下内容spec处添加
claimRef:
kind: PersistentVolumeClaim
namespace: 命名空间名
name: PVC名
spec:
accessModes:
- ReadWriteOnce
claimRef:
kind: PersistentVolumeClaim
namespace: 命名空间名
name: PVC名
添加后查看pv和PVC
再查看pod已经正常启动了。