Topic Eleven
Create a new PersistentVolumeClaim:
Name: pv-volume
Class: csi-hostpath-sc
Capacity: 10Mi
=======
Create a new Pod that hangs the volume on a PersistentVolumeClaim:
Name: web-server
Image: nginx
Mount path: /usr/share/nginx/html
Configure a new Pod with ReadWriteOnce permission on the volume
=======
Finally, use kubectl edit or kubectl patch to expand the pvc capacity to 70Mi, and record the changes.
Reference answer:
Open the official document, find the corresponding location, and copy the yaml file
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: task-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
changed to
after modification
Next, create a new pod and hang the volume on PersistentVolumeClaim
Open the official document, find the corresponding location, and copy the following yaml file
apiVersion: v1
kind: Pod
metadata:
name: task-pv-pod
spec:
volumes:
- name: task-pv-storage
persistentVolumeClaim:
claimName: task-pv-claim
containers:
- name: task-pv-container
image: nginx
ports:
- containerPort: 80
name: "http-server"
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: task-pv-storage
Revise
changed
Finally, use kubectl edit or kubectl patch to expand the pvc capacity to 70Mi, and record the changes
kubectl edit pvc pv-volume --save-config
just save
Notice
The nfs used in the simulation environment is used as the back-end storage, and does not support dynamic expansion of pvc. The test environment is ok