题目
Set configuration context $ kubectl config use-context hk8s
Creae a persistent volume with name app-config of capacity 2Gi and access mode ReadWriteOnce. The type of volume is hostPath and its location is /srv/app-config
答案
官网: Kubernetes 文档/任务/配置 Pods 和容器/配置 Pod 以使用 PersistentVolume 作为存储
https://kubernetes.io/zh/docs/tasks/configure-pod-container/configure-persistent-volume-storage/
apiVersion: v1
kind: PersistentVolume
metadata:
name: app-config
labels:
type: local
spec:
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/srv/app-config"