Practice Test - Persistent Volume Claims
Solution
-
Check the Solution
```
OK
```
-
Check the Solution
```
OK
```
-
Check the Solution
```
No
```
-
Check the Solution
```
apiVersion: v1
kind: Pod
metadata:
name: webapp
spec:
containers:
- name: event-simulator
image: kodekloud/event-simulator
env:
- name: LOG_HANDLERS
value: file
volumeMounts:
- mountPath: /log
name: log-volume
volumes:
- name: log-volume
hostPath:
# directory location on host
path: /var/log/webapp
# this field is optional
type: Directory
```
-
Check the Solution
```
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-log
spec:
accessModes:
- ReadWriteMany
capacity:
storage: 100Mi
hostPath:
path: /pv/log
```
-
Check the Solution
```
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: claim-log-1
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Mi
```
-
Check the Solution
```
PENDING
```
-
Check the Solution
```
AVAILABLE
```
-
Check the Solution
```
Access Modes Mismatch
```
-
Check the Solution
```
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: claim-log-1
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 50Mi
```
-
Check the Solution
```
100Mi
```
-
Check the Solution
```
apiVersion: v1
kind: Pod
metadata:
name: webapp
spec:
containers:
- name: event-simulator
image: kodekloud/event-simulator
env:
- name: LOG_HANDLERS
value: file
volumeMounts:
- mountPath: /log
name: log-volume
volumes:
- name: log-volume
persistentVolumeClaim:
claimName: claim-log-1
```
-
Check the Solution
```
Retain
```
-
Check the Solution
```
The PV is not delete but not available
```
-
Check the Solution
```
The PVC is stuck in `terminating` state
```
-
Check the Solution
```
The PVC is being used by a POD
```
-
Check the Solution
```
kubectl delete pod webapp
```
-
Check the Solution
```
Deleted
```
-
Check the Solution
```
Released
```