Certified Kubernetes Administrator(CKA) certification— Tips and Tricks!

·

5 min read

I have recently cleared CKA and want to give some tips and tricks to clear the same. I know there are tons of blogs/stories/suggestions which are out there for the same, so i’m trying to keep it concise and brief.

Initial phase

  • CKA curriculum

First thing is to get yourself familiarize with the CKA curriculum, this really helps you to divide the topics and know what weightage they carry according to curriculum. cncf/curriculum Open Source Curriculum for CNCF Certification Courses This is the the latest version of the curriculum for the…github.com

  • Candidate Handbook

This is very important to know at first itself as it answers most(all!) of the questions that you might have with respect to CKA exam. To summarise, it tells about Creating LF account, System requirements, where you can take test, confidentiality agreement, how to register and the exam fees, what ID’s can be used to verify yourself during exam, Preparation checklist, Platform (very imp), Scheduling exam, Resources allowed (very imp), Exam interface (very imp). Yes, you heard right, it also shows a glimpse of actual exam interface, technical instructions on what you can do in exam linux server, exam scoring etc.,

https://docs.linuxfoundation.org/tc-docs/certification/lf-candidate-handbook

More on exam interface : https://youtu.be/ZByl-a-eghc

  • CKA FAQs

Go through FAQs as well to understand more about the exam.

https://docs.linuxfoundation.org/tc-docs/certification/faq-cka-ckad-cks

Learning Phase

  • Resources needed

CKA Udemy course by Mumshad https://www.udemy.com/course/certified-kubernetes-administrator-with-practice-tests/

I would say this course is all you needed to understand the kubernetes from basics and understand each of the component in general and also from the certification perspective.

  • Other miscellaneous resources

Below resources also can be used to prepare yourself with some practice tests.

To get different perspective on questions:-

StenlyTU/K8s-training-official The goal of this tutorial is to give good understanding of Kubernetes and help preparing you for CKA, CKAD and CKS. To…github.com

For network policy related:-

ahmetb/kubernetes-network-policy-recipes You can get stuff like this with Network Policies... This repository contains various use cases of Kubernetes Network…github.com

  • Very Important tips during learning phase

a. Practice, practice and practice!! Try to complete tasks and Tutorials in kubernetes docs along with the course.

b. Make habit of referring kubernetes doc , kubernetes github for anything related to concepts, tasks or yaml files, as this really helps you during exam to easily search through docs.

c. Set kubectl autocomplete : source <(kubectl completion bash) echo "source <(kubectl completion bash)" >> ~/.bashrc alias k=kubectl complete -F __start_kubectl k

No need to remember this, its there in cheatsheet

For every kubectl command, You just need to type “k”, first letter of the next subcommands and press tab, autocomplete will take care, try it out!! :D

d. Set .vimrc(very imp) and .bashrc(optional)

**cat ~/.vimrc**
set expandtab
set tabstop=2
set shiftwidth=2
set autoindent
set smartindent
set bg=dark
set nowrap
set paste
set list # optional
set number # optional

cat ~/.bashrc
alias kgp='kubectl get pods -o wide'
alias kgd='kubectl get deploy -o wide'
alias kgs='kubectl get svc -o wide'
alias kgn='kubectl get nodes -o wide'
alias kgp='kubectl get pods -o wide'
do='--dry-run=client -o yaml'
sl='--show-labels'
alias kt='kubectl run test-$RANDOM --image=busybox:1.28 --rm -it --restart=Never'

Don’t forget to run source command to make the changes effective.

e. Know linux commands like grep, cut, awk, systemctl, ps, chown etc and these becomes handy many cases.

f. Use imperative commands as much as possible to create yaml skeleton and modify it accordingly.

k get pods -A
k run nginx --image=nginx $do > nginxpod.yaml
k run test-nslookup --image=busybox:1.28 --rm -it --restart=Never -- nslookup nginx-service

g. How to easily solve jsonpath question ?

Use jq to find out the json tree of the key you need. No need to remember this command as it’s there in cheatsheet.

kubectl get nodes -o json | jq -c 'path(..)|[.[]|tostring]|join(".")'

and try to filter out managedFields related entries by using grep as below.. and then do grep for the required field..

kubectl get nodes -o json | jq -c 'path(..)|[.[]|tostring]|join(".")' | grep -vi managedfields

For example, to get osImage of the nodes:-

# Get the json tree
controlplane $ kubectl get nodes -o json | jq -c 'path(..)|[.[]|tostring]|join(".")' | grep -vi managedfields | grep -i osimage
"items.0.status.nodeInfo.osImage"
"items.1.status.nodeInfo.osImage"

# Form jsonpath query
controlplane $ kubectl get nodes -o jsonpath='{.items[*].status.nodeInfo.osImage}'
Ubuntu 18.04.5 LTS Ubuntu 18.04.5 LTS

if student node doesn’t have jq, install using apt-get install jq

For better formating, you can also use custom-columns

# Use custom-columns for easy formating
controlplane $ kubectl get nodes -o custom-columns=NODE:.metadata.name,OSIMAGE:.status.nodeInfo.osImage
NODE           OSIMAGE
controlplane   Ubuntu 18.04.5 LTS
node01         Ubuntu 18.04.5 LTS

h. Create your own bookmarks which contains links to only allowed resources for exam.

i. Always validate the answers to the practice tests by yourself using kubectl commands rather than relying on GUI(in case of kodekloud labs)

When you are comfortable with these tips during learning phase, you’ll be used to it and it won’t be new stuff just before the exam.

During exam

  1. Always use context given in the exam before doing anything related to that particular task.

  2. Don’t waste time in single question, if you are not sure, Flag it and move on to next question. You are no afford to loose too much time for single question.

  3. Make sure to use the tips mentioned above which you might have practiced during learning phase itself.

  4. Keep yourself calm.

Happy learning! All the best!!

Follow me on twitter for interesting articles..

Thanks,