State Persistence
Some of the scenario questions here are based on Kodekloud's CKAD course labs.
CKAD and CKA can have similar scenario questions. It is recommended to go through the CKA practice tests.
Shortcuts
First run the two commands below for shortcuts.
export do="--dry-run=client -o yaml"
export now="--force --grace-period=0"
Questions
-
Configure a volume to store the webapp logs (stored at /log/app.log) at /var/log/webapp on the host. Use the spec provided below.
-
Name: webapp
-
Image Name: kodekloud/event-simulator
-
Volume HostPath: /var/log/webapp
-
Volume Mount: /log
Answer
-
-
Create a Persistent Volume with the given specification.
-
Volume Name: pv-log
-
Storage: 100Mi
-
Access Modes: ReadWriteMany
-
Host Path: /pv/log
-
Reclaim Policy: Retain
Answer
-
-
Create a Persistent Volume Claim with the given specification.
-
Volume Name: claim-log-1
-
Storage Request: 50Mi
-
Access Modes: ReadWriteMany
Answer
-
-
What is the Volume Binding Mode used for this storage class local-storage?
controlplane ~ ➜ k get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 9m44s
local-storage kubernetes.io/no-provisioner Delete WaitForFirstConsumer false 36s
portworx-io-priority-high kubernetes.io/portworx-volume Delete Immediate false 36sAnswer
-
Create a new PersistentVolumeClaim by the name of local-pvc that should bind to the volume local-pv.
-
PVC: local-pvc
-
Correct Access Mode?
-
Correct StorageClass Used?
-
PVC requests volume size = 500Mi?
Answer
-
-
Create a new pod called nginx with the image nginx:alpine. The Pod should make use of the PVC local-pvc and mount the volume at the path /var/www/html. The PV local-pv should be in a bound state.
controlplane ~ ➜ k get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
local-pv 500Mi RWO Retain Available local-storage 29m
controlplane ~ ➜ k get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
local-pvc Pending local-storage 5m17sAnswer
-
Create a new Storage Class called delayed-volume-sc that makes use of the below specs:
-
provisioner: kubernetes.io/no-provisioner
-
volumeBindingMode: WaitForFirstConsumer
Answer
-