After completing CKA and CKAD certifications, I thought of writing few posts with exercises that can be used by anyone preparing for K8s certifications. I will try my best to cover from basics to complicated ones with both imperative and declarative way wherever possible. This is not same as actual exam and created just for practice, this might help you a lot while preparing as I have covered most of the topics that is part of exam curriculum.
Tip: Make use of imperative commands wherever possible in exam.
- Create a new pod app-1 with nginx image and list the pods in default namespace.
declarative: save the below code into yaml file and run the command kubectl create -f <file-name>.yaml
2. Delete the pod app-1 we just created:
3. Create a new namespace amazon:
declarative: save the below code into yaml file and run the command kubectl create -f <file-name>.yaml
4.create a new pod app-2 with nginx image in amazon namespace
declarative:
5. List the pods in amazon namespace
6. Create a new pod app-3 with nginx image and tag 3
declarative:
7. Create a new pod app-4 with image nginx:12345, check the status of the pod created.
8. Update the pod app-4 to use correct image nginx
or
9. List pods from all namespaces:
10. List services from all namespaces:
11. List services from default namespace:
12. Get complete details of pod app-4
13. Check pods from all namespaces with node names they are located and IP address of pods:
14. Output the pod app-4 to /tmp directory as output-app4.yaml:
Tip: https://kubernetes.io/docs/reference/kubectl/cheatsheet/ Refer to this URL for more examples.
15. List all the pods showing name and namespace with jsonpath expression:
16. Create the pod app-5 with nginx image and expose it on port 80
17. Create a pod app-6 with busy box image and command sleep 4800:
18. Create a pod app-7 with busy box image and run command hostname while creating, check the logs of pod app-7:
20. Connect to the pod app-6 and check hostname
21. Check the Image version of pod app-7 using jsonpath:
22.