Part4 存储
12. PV (4%)
Task
Create a persistent volume with name app-config , of capacity 1Gi and access mode ReadOnlyMany . The type of volume is hostPath and its location is /srv/app-config .
解题:
cat > 12-pv.yaml << EOF
apiVersion: v1
kind: PersistentVolume
metadata:
name: app-config
spec:
capacity:
storage: 1Gi
accessModes:
- ReadOnlyMany
hostPath:
path: "/srv/appconfig"
EOF
kubectl create -f 12-pv.yaml
13. PVC (7%)
Task
Createt a new PersistentVolumeClaim :
Name:
pv-volumeClass:
csi-hostpath-scCapacity:
10Mi
Create a new Pod which mounts the PersistentVolumeClaim as a volume:
Name:
web-serverImage:
nginxMount path:
/usr/share/nginx/html
Configure the new Pod to have ReadWriteOnce access on the volume.
Finally, using kubectl edit or kubectl patch expand the PersistentVolumeClaim to a capacity of 70Mi and record that change.
解题:
Last updated