k8s 创建数据存储PVC(Persistent Volume Claims)
【代码】k8s 创建数据存储PVC(Persistent Volume Claims)
·
k8s 创建数据存储PVC(Persistent Volume Claims)
文章目录
1.创建pv
1.1 编写pv部署文件consul-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: consul-pv
spec:
capacity:
storage: 2Gi
accessModes:
- ReadWriteMany
nfs:
server: 192.168.154.129
path: /root/consul
1.2 创建pv
kubectl apply -f consul-pv.yaml
nfs安装步骤: https://blog.csdn.net/FengShiLiuNian/article/details/140297090
2.创建pvc
2.1编写pv部署文件consul-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: consul-pvc
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
2.2 部署pvc
kubectl apply -f consul-pvc.yaml
2.3 查看pvc状态
kubectl get pvc
期望结果如下:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
consul-pvc Bound consul-pv 2Gi RWX 40m
更多推荐
已为社区贡献1条内容
所有评论(0)