CKA – Quick tips

This week I completed my CKA with 96% in just few weeks of learning and in this blog post I will be sharing some tips and guidelines that can help you get one.

Video course :

https://www.udemy.com/course/certified-kubernetes-administrator-with-practice-tests/

This is probably one of the best video course you can opt for and that too in really low cost on Udemy (~400 Rs.). The course has both theoretical concepts explained in detail, awesome hands on labs to practice and the mock tests to help pass the exam with flying colours.

Make sure to complete the labs and specially mock exams at-least twice or thrice.

In exam tips :

  1. No, its not the toughest as mentioned in some medium blogs, it’s easy if you have done the course along with mocks and lightning labs twice.
  2. Double check the name of the pod / deployment, name of container, service name, context you are using, labels and namespace (it’s silly mistake prone area).
  3. You will given a bastion host at first which has 5 contexts (clusters) already set. Make sure you are on the right context before starting the exam, its mentioned on top of each question in bold letters.
  4. ssh access is provided for all 5 clusters (masters and nodes), ssh commands are already provided in questions wherever required.
  5. K8s version in exam is 1.18 (as of April 2020) so certain commands change like --dry-run becomes --dry-run=client and kubectl run can now only create pods without --generator flags.
  6. cmd+c and cmd+v works just fine (for Macbook at least)
  7. Bookmark cheatsheet page – https://kubernetes.io/docs/reference/kubectl/cheatsheet/
  8. Set autocomplete before starting – https://kubernetes.io/docs/reference/kubectl/cheatsheet/#kubectl-autocomplete
  9. Use imperative commands as much as possible and edit as per the requirements of question :
    • Do kubectl create deployment nginx --image nginx --dry-run=client -o yaml > deploy.yaml and edit deploy.yaml for x number of replicas and apply the deploy.yaml to create a deployment with x number of replicas.
    • kubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml to create an nginx pod yaml and apply the yaml after making any required changes.
    • kubectl expose pod/deployment --name nginx-service --type ClusterIP --port 80 --target-port 80 --dry-run=client -o yaml > svc.yaml to expose a pod or deployment
    • kubectl create secret generic db-secret --from-literal=password=confidential (no need to encode the secret confidential, its encoded on its own when using imperative commands)
    • When you do --dry-run=client -o yaml, redirect the yaml output to the current question number (like --dry-run=client -o yaml > 1.yaml for first question), so later its quick, easy to revalidate the attempt and edit changes if any.
  10. Following are some other important commands that would be useful :
    • journalctl -u kubelet to get kubelet service logs (tail the logs in case needed)
    • systemctl status kubelet , systemctl restart kubelet and systemctl daemon-reload to get the status of kubelet and restart in case needed.
    • kubeadm init --config=/location/of/kubeadm.config to create a kubeadm cluster with provided config
  11. jsonpath is not really needed (simply copy paste the required pod name to required text file name), --sort-by is needed for sorting resources based on certain criteria.
  12. Use https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/#create-a-simple-pod-to-use-as-a-test-environment to nslookup on any ClusterIP service and pod.
  13. Make use of -l abc=xyz and --show-lables like kubectl get pods -l abc=xyz and kubectl get nodes --show-labels to get through things faster.
  14. Yes, you can copy whole yaml from docs as well, so use it for the objects like persistentvolumes for which there are no imperative commands instead of typing yaml in vim.
  15. You will have ample amount of time so make sure to read (twice) and understand the question well before attempting.
  16. It might take more than 30 hours for getting the results on email and portal.

Finally, special thanks to folks at Srijan for immense support and guidance!

Feel free to get in touch in case of issues and concerns.

$ kubectl get cka

7 thoughts on “CKA – Quick tips

Leave a comment