不等更新题库
文章目录
- 10、创建 PV
- 题目:
- 考点:
- 参考链接:
- 解答:
- 更换 context
- 创建 pv yaml
- 创建 pv
- 检查
10、创建 PV
题目:
设置配置环境:
[candidate@node-1] $ kubectl config use-context hk8sTask
创建名为 app-config 的 persistent volume,容量为 1Gi,访问模式为 ReadWriteMany。 volume 类型为 hostPath,位于 /srv/app-config
考点:
hostPath 类型的 pv
参考链接:
依次点击 Tasks → Configure Pods and Containers → Configure a Pod to Use a PersistentVolume for Storage (看不懂英文的,可右上角翻译成中文)
https://kubernetes.io/zh-cn/docs/tasks/configure-pod-container/configure-persistent-volume-storage/
解答:
更换 context
$ kubectl config use-context hk8s
创建 pv yaml
# 复制官网模版, 修改
$ cat 10.pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:name: app-config # 名labels:type: local
spec:# storageClassName: manual 题目没指定capacity:storage: 1Gi # 容量accessModes:- ReadWriteMany # 读写权限hostPath:path: "/srv/app-config" # 题目有指定
创建 pv
$ kubectl create -f 10.pv.yaml
检查
$ kubectl describe pv app-config