题目12:按要求创建PV
题目12:按要求创建PV
设置配置环境kubectl config use-context k8s
创建名为app-data的persistent volume,容量为1Gi,访问模式为ReadWriteMany。volume
类型为hostPath,位于/srv/app-data。
中文参考地址:配置 Pod 以使用 PersistentVolume 作为存储 | Kubernetes
英语参考地址:配置 Pod 以使用 PersistentVolume 作为存储 | Kubernetes
解答:
1、切换答题环境(考试环境有多个,每道题要在对应的环境中作答)
kubectl config use-context k8s
2、创建yaml文件
vi app-data.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: app-data
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/srv/app-data"
3、执行yaml文件
kubectl apply -f app-data.yaml
赏
支付宝打赏
微信打赏


赞赏是不耍流氓的鼓励