Complete the code to define a simple emptyDir volume in a pod spec.
volumes:
- name: cache-volume
[1]: {}The emptyDir volume type creates a temporary directory that exists as long as the pod runs.
Complete the code to reference a PersistentVolumeClaim in a pod volume.
volumes:
- name: data-storage
[1]:
claimName: my-pvcThe persistentVolumeClaim volume type links a pod to a PersistentVolumeClaim, which manages persistent storage.
Fix the error in the PersistentVolumeClaim YAML by completing the missing access mode.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-pvc
spec:
accessModes:
- [1]
resources:
requests:
storage: 1GiReadWriteOnce is the most common access mode allowing the volume to be mounted as read-write by a single node.
Fill both blanks to create a pod volume that uses a PersistentVolumeClaim named 'data-pvc' and mounts it at '/data'.
volumes:
- name: data-volume
[1]:
claimName: data-pvc
containers:
- name: app
volumeMounts:
- name: data-volume
mountPath: [2]The volume uses persistentVolumeClaim to link to the claim, and the mount path /data is where the volume is accessible inside the container.
Fill all three blanks to define a PersistentVolume with 5Gi storage, access mode ReadWriteOnce, and hostPath '/mnt/data'.
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-data
spec:
capacity:
storage: [1]
accessModes:
- [2]
hostPath:
path: [3]The storage capacity is set to 5Gi, the access mode is ReadWriteOnce, and the hostPath points to /mnt/data on the node.