Practice Enough With These 150 Questions For The CKAD Exam - by Bhargav Bachina - Bachina Labs - Medium
Practice Enough With These 150 Questions For The CKAD Exam - by Bhargav Bachina - Bachina Labs - Medium
Save
as deploying apps, configuring apps, rolling out the application, creating persistent
volumes, etc.
Since this exam is performance-based rather than just multiple choice questions just
knowing the concepts are not enough, we need a lot of practice before the exam. This
article helps you understand, practice and get you ready for the exam.
We are not going to discuss any concepts here, rather, I just want to create a bunch of
practice questions for the CKAD exam based on the curriculum provided here.
Configuration (18%)
Observability (18%)
kubectl get ns
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 2/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
5. List all the pods showing name and namespace with a json path expression
6. Create an nginx pod in a default namespace and verify the pod running
// creating a pod
kubectl get po
// cat nginx-pod.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 3/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
spec:
containers:
- image: nginx
Open in app Get started
name: nginx
resources: {}
dnsPolicy: ClusterFirst
restartPolicy: Never
status: {}
// create a pod
9. Output the yaml file of the pod you just created without the cluster-specific
information
10. Get the complete details of the pod you just created
12. Delete the pod you just created without any delay (force delete)
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 4/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
13. Create the nginx pod with version 1.17.4 and expose it on port 80
Open in app Get started
14. Change the Image version to 1.15-alpine for the pod you just created and verify
the image version is updated
15. Change the Image version back to 1.17.1 for the pod you just updated and
observe the changes
17. Create the nginx pod and execute the simple shell on the pod
// creating a pod
19. Create a busybox pod and run command ls while creating it and check the logs
22. Check the connection of the nginx pod from the busybox pod
23. Create a busybox pod and echo message ‘How are you’ and delete it manually
24 Create a busybox pod and echo message ‘How are you’ and have it deleted
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 6/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
24. Create a busybox pod and echo message ‘How are you’ and have it deleted
immediately Open in app Get started
25. Create an nginx pod and list the pod with different levels of verbosity
1.93K 51
// create a pod
26. List the nginx pod with custom columns POD_NAME and POD_STATUS
29. Create a Pod with three busy box containers with commands “ls; sleep 3600;”,
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 7/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
“echo Hello World; sleep 3600;” and “echo this is the third container; sleep 3600”
Open in app Get started
1 apiVersion: v1
2 kind: Pod
3 metadata:
4 creationTimestamp: null
5 labels:
6 run: busybox
7 name: busybox
8 spec:
9 containers:
10 - args:
11 - bin/sh
12 - -c
13 - ls; sleep 3600
14 image: busybox
15 name: busybox1
16 resources: {}
17 - args:
18 - bin/sh
19 - -c
20 - echo Hello world; sleep 3600
21 image: busybox
22 name: busybox2
23 resources: {}
24 - args:
25 - bin/sh
26 - -c
27 - echo this is third container; sleep 3600
28 image: busybox
29 name: busybox3
30 resources: {}
31 dnsPolicy: ClusterFirst
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 8/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
32 restartPolicy: Never
Open in app Get started
33 status: {}
❤ i
multi-container pod
30. Check the logs of each container that you just created
31. Check the previous logs of the second container busybox2 if any
32. Run command ls in the third container busybox3 of the above pod
33. Show metrics of the above pod containers and puts them into the file.log and
verify
cat file.log
34. Create a Pod with main container busybox and which executes this “while true;
do echo ‘Hi I am from Main container’ >> /var/log/index.html; sleep 5; done” and
with sidecar container with nginx image which exposes on port 80. Use emptyDir
Volume and mount this volume on path /var/log for busybox and on path
/usr/share/nginx/html for nginx container. Verify both containers are running.
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 9/55
19/05/2022, 18:07 y With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
Practice Enough
1 apiVersion: v1
2 kind: Pod
3 metadata:
4 creationTimestamp: null
5 labels:
6 run: multi-cont-pod
7 name: multi-cont-pod
8 spec:
9 volumes:
10 - name: var-logs
11 emptyDir: {}
12 containers:
13 - image: busybox
14 command: ["/bin/sh"]
15 args: ["-c", "while true; do echo 'Hi I am from Main container' >> /var/log/index.h
16 name: main-container
17 resources: {}
18 volumeMounts:
19 - name: var-logs
20 mountPath: /var/log
21 - image: nginx
22 name: sidecar-container
23 resources: {}
24 ports:
25 - containerPort: 80
26 volumeMounts:
27 - name: var-logs
28 mountPath: /usr/share/nginx/html
29 dnsPolicy: ClusterFirst
30 restartPolicy: Never
31 status: {}
i i ❤ i view raw
multi-container.yaml
35. Exec into both containers and verify that main.txt exist and query the main.txt
from sidecar container with curl localhost
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 10/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
cat /var/log/main.txt
cat /usr/share/nginx/html/index.html
# curl localhost
37. Create 5 nginx pods in which two of them is labeled env=prod and three of them
is labeled env=dev
k b tl i d2 i i t t N
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 11/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
kubectl run nginx-prod2 --image=nginx --restart=Never --
labels=env=prod Open in app Get started
38. Verify all the pods are created with correct labels
40. Get the pods with label env=dev and also output the labels
42. Get the pods with label env=prod and also output the labels
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 12/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
45. Get the pods with labels env=dev and env=prod and output
Open inthe
app labels
Getas well
started
46. Change the label for one of the pod to env=uat and list all the pods to verify
47. Remove the labels for the pods that we created now and verify all the labels are
removed
48. Let’s add the label app=nginx for all the pods and verify
49. Get all the nodes with labels (if using minikube you would get only master node)
51. Create a Pod that will be deployed on this node with the label
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 13/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nodeName=nginxnode
Open in app Get started
1 apiVersion: v1
2 kind: Pod
3 metadata:
4 creationTimestamp: null
5 labels:
6 run: nginx
7 name: nginx
8 spec:
9 nodeSelector:
10 nodeName: nginxnode
11 containers:
12 - image: nginx
13 name: nginx
14 resources: {}
15 dnsPolicy: ClusterFirst
16 restartPolicy: Never
17 status: {}
pod.yaml
hosted with ❤ by GitHub view raw
pod.yaml
52. Verify the pod that it is scheduled with the node selector
53. Verify the pod nginx that we just created has this label
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 14/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
Open in app
kubectl annotate pod nginx-prod{1..2} name=webapp Get started
58. Create a deployment called webapp with image nginx with 5 replicas
1 apiVersion: apps/v1
2 kind: Deployment
3 metadata:
4 creationTimestamp: null
5 labels:
6 app: webapp
7 name: webapp
8 spec:
9 replicas: 5
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 15/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
10 selector:
Open in app Get started
11 matchLabels:
12 app: webapp
13 strategy: {}
14 template:
15 metadata:
16 creationTimestamp: null
17 labels:
18 app: webapp
19 spec:
20 containers:
21 - image: nginx
22 name: nginx
23 resources: {}
24 status: {}
60. Output the yaml file of the deployment you just created
65. Get the yaml of the replicaset and pods of this deployment
66. Delete the deployment you just created and watch all the pods are also being
deleted
67. Create a deployment of webapp with image nginx:1.17.1 with container port 80
and verify the image version
// verify
1 apiVersion: apps/v1
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 17/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
1 apiVersion: apps/v1
2 kind: Deployment Get started
Open in app
3 metadata:
4 creationTimestamp: null
5 labels:
6 app: webapp
7 name: webapp
8 spec:
9 replicas: 1
10 selector:
11 matchLabels:
12 app: webapp
13 strategy: {}
14 template:
15 metadata:
16 creationTimestamp: null
17 labels:
18 app: webapp
19 spec:
20 containers:
21 - image: nginx:1.17.1
22 name: nginx
23 ports:
24 - containerPort: 80
25 resources: {}
26 status: {}
68. Update the deployment with the image version 1.17.4 and verify
69. Check the rollout history and make sure everything is ok after the update
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 18/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
70. Undo the deployment to the previous version 1.17.1 and verify Image has the
Open in app Get started
previous version
71. Update the deployment with the image version 1.16.1 and verify the image and
also check the rollout history
72. Update the deployment to the Image 1.17.1 and verify everything is ok
73. Update the deployment with the wrong image version 1.100 and verify
something is wrong with the deployment
74. Undo the deployment with the previous version and verify everything is Ok
k b tl t d
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 19/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
kubectl get pods
Open in app Get started
77. Update the deployment with the image version latest and check the history and
verify nothing is going on
79. Check the rollout history and verify it has the new version
80. Apply the autoscaling to this deployment with minimum 10 and maximum 20
replicas and target CPU of 85% and verify hpa is created and replicas are increased
to 10 from 1
81. Clean the cluster by deleting deployment and hpa you just created
82. Create a Job with an image node which prints node version and also verifies
there is a pod created for this job
84.Output the yaml file for the Job with the image busybox which echos “Hello I am
from job”
85. Copy the above YAML file to hello-job.yaml file and create the job
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 21/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
kubectl get po
88. Create the same job and make it run 10 times one after one
1 apiVersion: batch/v1
2 kind: Job
3 metadata:
4 creationTimestamp: null
5 name: hello-job
6 spec:
7 completions: 10
8 template:
9 metadata:
10 creationTimestamp: null
11 spec:
12 containers:
13 - command:
14 - echo
15 - Hello I am from job
16 image: busybox
17 name: hello-job
18 resources: {}
19 restartPolicy: Never
20 status: {}
hello-job.yaml
Open in app Get started
89. Watch the job that runs 10 times one by one and verify 10 pods are created and
delete those after it’s completed
kubectl get po
90. Create the same job and make it run 10 times parallel
1 apiVersion: batch/v1
2 kind: Job
3 metadata:
4 creationTimestamp: null
5 name: hello-job
6 spec:
7 parallelism: 10
8 template:
9 metadata:
10 creationTimestamp: null
11 spec:
12 containers:
13 - command:
14 - echo
15 - Hello I am from job
16 image: busybox
17 name: hello-job
18 resources: {}
19 restartPolicy: Never
20 status: {}
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 23/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
91. Watch the job that runs 10 times parallelly and verify 10 pods are created and
Open in app Get started
delete those after it’s completed
kubectl get po
92. Create a Cronjob with busybox image that prints date and hello from kubernetes
cluster message for every minute
94. Verify that CronJob creating a separate job and pods for every minute to run
and verify the logs of the pod
kubectl get po
95. Delete the CronJob and verify all the associated jobs and pods are also deleted.
kubectl get po
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 24/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
kubectl get pv
kubectl get pv
1 apiVersion: v1
2 kind: PersistentVolume
3 metadata:
4 name: task-pv-volume
5 labels:
6 type: local
7 spec:
8 storageClassName: manual
9 capacity:
10 storage: 10Gi
11 accessModes:
12 - ReadWriteOnce
13 hostPath:
14 path: "/mnt/data"
task-pv-volume.yaml
hosted with ❤ by GitHub view raw
task-pv-volume.yaml
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 25/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
1 apiVersion: v1
2 kind: PersistentVolumeClaim
3 metadata:
4 name: task-pv-claim
5 spec:
6 storageClassName: manual
7 accessModes:
8 - ReadWriteOnce
9 resources:
10 requests:
11 storage: 3Gi
task-pv-claim.yaml
hosted with ❤ by GitHub view raw
task-pv-claim.yaml
100. Create a Pod with an image Redis and configure a volume that lasts for the
lifetime of the Pod
// emptyDir is the volume that lasts for the life of the pod
1 apiVersion: v1
2 kind: Pod
3 metadata:
4 name: redis
5 spec:
6 containers:
7 - name: redis
8 image: redis
9 volumeMounts:
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 26/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
10 - name: redis-storage
11 mountPath: /data/redis Open in app Get started
12 volumes:
13 - name: redis-storage
14 emptyDir: {}
redis-storage.yaml
hosted with ❤ by GitHub view raw
101. Exec into the above pod and create a file named file.txt with the text ‘This is
called the file’ in the path /data/redis and open another tab and exec again with the
same pod and verifies file exist in the same path.
// first terminal
cd /data/redis
cat /data/redis/file.txt
102. Delete the above pod and create again from the same yaml file and verifies
there is no file.txt in the path /data/redis
kubectl get pv
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 27/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
1 apiVersion: v1
2 kind: Pod
3 metadata:
4 name: task-pv-pod
5 spec:
6 volumes:
7 - name: task-pv-storage
8 persistentVolumeClaim:
9 claimName: task-pv-claim
10 containers:
11 - name: task-pv-container
12 image: nginx
13 ports:
14 - containerPort: 80
15 name: "http-server"
16 volumeMounts:
17 - mountPath: "/usr/share/nginx/html"
18 name: task-pv-storage
Configuration (18%)
Practice questions based on these concepts
Understand ConfigMaps
Understand SecurityContexts
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 28/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
Understand ServiceAccounts
Open in app Get started
kubectl get cm
or
or
kubectl describe cm
109. Create a file called config.txt with two values key1=value1 and key2=value2
and verify the file
key1=value1
key2=value2
EOF
cat config.txt
110. Create a configmap named keyvalcfgmap and read data from the file
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 29/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
111. Create an nginx pod and load environment values from the above configmap
keyvalcfgmap and exec into the pod and verify the environment variables and delete
the pod
// verify
1 apiVersion: v1
2 kind: Pod
3 metadata:
4 creationTimestamp: null
5 labels:
6 run: nginx
7 name: nginx
8 spec:
9 containers:
10 - image: nginx
11 name: nginx
12 resources: {}
13 envFrom:
14 - configMapRef:
15 name: keyvalcfgmap
16 dnsPolicy: ClusterFirst
17 restartPolicy: Never
18 status: {}
112. Create an env file file.env with var1=val1 and create a configmap envcfgmap
from this env file and verify the configmap
cat file.env
113. Create an nginx pod and load environment values from the above configmap
envcfgmap and exec into the pod and verify the environment variables and delete
the pod
// verify
1 apiVersion: v1
2 kind: Pod
3 metadata:
4 creationTimestamp: null
5 labels:
6 run: nginx
7 name: nginx
8 spec:
9 containers:
10 - image: nginx
11 name: nginx
12 resources: {}
13 env:
14 - name: ENVIRONMENT
15 valueFrom:
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 31/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
16 configMapKeyRef:
17 name: envcfgmap Open in app Get started
18 key: var1
19 dnsPolicy: ClusterFirst
20 restartPolicy: Never
21 status: {}
114. Create a configmap called cfgvolume with values var1=val1, var2=val2 and
create an nginx pod with volume nginx-volume which reads data from this
configmap cfgvolume and put it on the path /etc/cfg
cd /etc/cfg
ls
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 32/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nginx-volume.yml
115. Create a pod called secbusybox with the image busybox which executes
command sleep 3600 and makes sure any Containers in the Pod, all processes run
with user ID 1000 and with group id 2000 and verify.
// verify
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 33/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
busybox.yml
116. Create the same pod as above this time set the securityContext for the container
as well and verify that the securityContext of container overrides the Pod level
securityContext.
// verify
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 34/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
busybox.yml
117. Create pod with an nginx image and configure the pod with capabilities
NET_ADMIN and SYS_TIME verify the capabilities
cd /proc/1
cat status
CapPrm: 00000000aa0435fb
CapEff: 00000000aa0435fb
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 35/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nginx.yml
118. Create a Pod nginx and specify a memory request and a memory limit of 100Mi
and 200Mi respectively.
// verify
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 36/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nginx.yml
119. Create a Pod nginx and specify a CPU request and a CPU limit of 0.5 and 1
respectively.
// verify
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 37/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nginx.yml
120. Create a Pod nginx and specify both CPU, memory requests and limits together
and verify.
// verify
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 38/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nginx.yml
121. Create a Pod nginx and specify a memory request and a memory limit of 100Gi
and 200Gi respectively which is too big for the nodes and verify pod fails to start
because of insufficient memory
// verify
nginx.yml
125. Create an nginx pod which reads username as the environment variable
//verify
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 41/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nginx.yml
126. Create an nginx pod which loads the secret as environment variables
//verify
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 42/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nginx.yml
kubectl get sa
130. Output the YAML file for the service account we just created
131. Create a busybox pod which executes this command sleep 3600 with the service
account admin and verify
// verify
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 43/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
busybox.yml
Observability (18%)
Practice questions based on these concepts
132. Create an nginx pod with containerPort 80 and it should only receive traffic
only it checks the endpoint / on port 80 and verify and delete the pod.
// verify
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 45/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nginx-pod.yaml
133. Create an nginx pod with containerPort 80 and it should check the pod
running at endpoint / healthz on port 80 and verify and delete the pod.
// verify
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 46/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nginx-pod.yaml
134. Create an nginx pod with containerPort 80 and it should check the pod
running at endpoint /healthz on port 80 and it should only receive traffic only it
checks the endpoint / on port 80. verify the pod.
// verify
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 47/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nginx-pod.yaml
135. Check what all are the options that we can configure with readiness and
liveness probes
136. Create the pod nginx with the above liveness and readiness probes so that it
should wait for 20 seconds before it checks liveness and readiness probes and it
should check every 25 seconds.
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 48/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nginx-pod.yaml
137. Create a busybox pod with this command “echo I am from busybox pod; sleep
3600;” and verify the logs.
138. copy the logs of the above pod to the busybox-logs.txt and verify
cat busybox-logs.txt
139. List all the events sorted by timestamp and put them into file.log and verify
cat file.log
140. Create a pod with an image alpine which executes this command ”while true;
do echo ‘Hi I am from alpine’; sleep 5; done” and verify and follow the logs of the
pod.
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 49/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
https://gist.githubusercontent.com/bbachi/212168375b39e36e2e2984c097167b0
0/raw/1fd63509c3ae3a3d3da844640fb4cca744543c1c/not-running.yml. The pod
is not in the running state. Debug it.
kubectl create -f
https://gist.githubusercontent.com/bbachi/212168375b39e36e2e2984c097
167b00/raw/1fd63509c3ae3a3d3da844640fb4cca744543c1c/not-running.yml
or
142. This following yaml creates 4 namespaces and 4 pods. One of the pod in one of
the namespaces are not in the running state. Debug and fix it.
https://gist.githubusercontent.com/bbachi/1f001f10337234d46806929d1224539
7/raw/84b7295fb077f15de979fec5b3f7a13fc69c6d83/problem-pod.yaml.
kubectl create -f
https://gist.githubusercontent.com/bbachi/1f001f10337234d46806929d12
245397/raw/84b7295fb077f15de979fec5b3f7a13fc69c6d83/problem-pod.yaml
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 50/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
Open in app
kubectl set image pod/pod2 pod2=nginx -n namespace2 Get started
// verify again
143. Get the memory and CPU usage of all the pods and find out top 3 pods which
have the highest usage and put them into the cpu-usage.txt file
// verify
cat cpu-usage.txt
Understand Services
144. Create an nginx pod with a yaml file with label my-nginx and expose the port
80
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 51/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nginx.yaml
145. Create the service for this nginx pod with the pod selector app: my-nginx
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 52/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
nginx-svc.yaml
146. Find out the label of the pod and verify the service has the same label
147. Delete the service and create the service with kubectl expose command and
verify the label
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 53/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
148. Delete the service and create the service again with type NodePort
Open in app Get started
149. Create the temporary busybox pod and hit the service. Verify the service that it
should return the nginx page index.html.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny
spec:
podSelector: {}
policyTypes:
- Ingress
Conclusion
CKAD is a performance-based exam and it’s all about completing 19 questions within 2
hours. We need a lot of practice for it. These 150 questions give you enough practice for
the exam. The more you practice the more comfortable you feel during the exam.
Practice. Practice. Practice.
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 54/55
19/05/2022, 18:07 Practice Enough With These 150 Questions for the CKAD Exam | by Bhargav Bachina | Bachina Labs | Medium
Tutorials Ranging from Beginner guides to advanced on Frontend, Backend, Blockchain, Docker, k8s,
DevOps, Cloud,AI, ML. Thank you for subscribing and let me know if you want me cover anything?
Take a look.
Your email
By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information
about our privacy practices.
https://medium.com/bb-tutorials-and-thoughts/practice-enough-with-these-questions-for-the-ckad-exam-2f42d1228552 55/55