The reason why I decided to share this page is because there is insufficient source of explicitly guiding Kubernetes beginner how to approach lab exercises efficiently. Besides, it would be also conducive to prepare for CKAD exam the upcoming 3 months. Hope that by looking through the explanation of how to approach the lab questions in Lightning Lab 1 exercise, the readers could understand the strategy of resolving it easier.
Q1.
Step 1:
To create a yaml file named lightning_lab_solution_q1.yaml, then start editing it.
vi lightning_lab_solution_q1.yaml
Step 2:
Following the specific requirements written by questions, and then typing it into lightning_lab_solution_q1.yaml.
Step 3.
To create the Persisten Volume log-volume, Q1 is finished.
kubectl create -f lightning_lab_solution_q1.yaml
Q2.
Step 1.
To create a yaml file named lightning_lab_solution_q2.yaml, then doing the same procedure as Q1 Step1.
vi lightning_lab_solution_q2.yaml
Step 2.
Opening vi editor, then deploying a pod named secure-pod, and service called secure-service, as shown below lightning_lab_solution_q2.yaml.
Step 3.
To check matchLabels,
kubectl get po --show-labels
Step 4.
To examine whether pod webapp-color is connecting or not, Q2 completed!
kubectl exec -it webapp-color -- nc -z -v -w 1 secure-service 80
Q3.
Step 1.
Create a yaml file named lightning_lab_solution_q3.yaml,
vi lightning_lab_solution_q3.yaml
Step 2.
Editing lightning_lab_solution_q3.yaml into the below solution manifest,
Step 3.
To create a namespace named dvl1987,
kubectl create ns dvl1987
Step 4.
To create a config map called time-config with data TIME_FREQ=10 in the same namespace,
kubectl create configmap time-config --from-literal=TIME_FREQ=10 -n dvl1987
Step 5.
After creating both namespace and configmap, then create a pod named time-check,
kubectl create -f lightning_lab_solution_q3.yaml
Step 6.
To check whether log file successfully outputs time report every 10 seconds.
If successful, it will display the output as below:
Step 7.
To examine search for the time frequency in the environment.
kubectl -n dvl1987 exec -it time-check -- env | grep TIME_FREQ
If correct, then displaying the below output, Q3 completed.
Q4.
Step 1.
Create a yaml file named lightning_lab_solution_q4.yaml,
vi lightning_lab_solution_q4.yaml
Step 2.
Revising lightning_lab_solution_q4.yaml into the below solution manifest,
Step 3.
kubectl create -f lightning_lab_solution_q4.yaml
Step 4.
To upgrade deployment version to 1.17,
kubectl set image deployment/nginx-deploy nginx=nginx:1.17
Step 5.
Undo the update,
kubectl create -f lightning_lab_solution_q5.yaml
Step 6.
Check current version of deployment nginx-deploy, Q4 done!
kubectl describe deployment nginx-deploy
Q5.
Step 1.
Create a yaml file named lightning_lab_solution_q5.yaml,
vi lightning_lab_solution_q5.yaml
Step 2.
Revising lightning_lab_solution_q5.yaml into the below solution manifest,
Step 3.
To create a deployment named redis, Q5 done!
kubectl create -f lightning_lab_solution_q5.yaml
Finally, if all the questions passed the tests, then the score would be 100%.