Ever since I first read my kubernetes article about 2 years ago, I fell in love with it. It was the same when I first read about git or docker or spring dependency injection, you immediately recognise this is the future and it will fundamentally change about how we think about logical+deployment architecture. For me, its was the missing piece of puzzle in microservices land. So far I had a fair understanding and experience of migrating big monolith into microservices and packaging with docker and 12 factor etc but didn’t have a good answer of running them as a fleet. Amazon ECS was something I was toying with about 3 yrs ago but it was far from the abstractions I was after.
Paying homage to my obsession with k8s, recently I got my CKA cert on the 2nd attempt. I thought I was ready on my first try but got only 72 (you need 74……I know right!).
While the memory is fresh, I thought I’d write a few lines on what I learned from failing the 1st attempt and did differently on 2nd attempt.
Did I know more kubernetes when I attempted for the 2nd time? Absolutely not! But I changed my strategy.
I would not repeat whats already out there, there are a lot of material online on this, here is a few link:
- How to nail the CKA exam
- Nicely listed k8s curriculum with links
- And K8s Docs
- K8S the hard way (dont even bother attempting the exam without deeply understanding each and every step. Dont just copy paste)
Time for Preparation:
I saw people spending a 2-3 month for prep but I didn’t have too much time to prepare, been super busy with my day-job (we just released KAYO (yay) in 5 months and pulling off very long hours and working on weekends too) so I only had the partial weekends to study, on average I think I spent about 4 hours every weekend over 8 weekends + PLUS spent about 3-4 hours * 5 days on Christmas break before the exam. Having said that, I’m no stranger to k8s, I have been running it in prod for more than 1 year. But that is of little use for the exam.
TIP#1: The exam is all about imperative commands.
If you are used to declarative style (I am a big HELM fan and write helm chart for everything), you need to get that out of head and learn your 1 liners. Practice everything on K8s Cheatsheet , make sure you can create pod, deployment, service etc using the kubectl. I tried doing yaml files and use that to create resources on my 1st attempt, didn’t work. If you take one command out of this post, take this:
kubectl run -it --rm test --restart=Never --image=busybox --command -- 'echo' 'echo no need' 'echo bye'
kubectl run testPod --restart=Never --image=nginx(–restart=Never creates PODS)
kubectl run myDeployment --image=nginx
kubectl run testDeployment --image=nginx --dry-run -oyaml > myDeployment.yaml
- kubectl apply -f myDeployment.yaml
- kubectl delete -f myDeployment.yaml
TIP#2: Get used to your environment
This is probably the most important tip. The exam uses GateOne web based terminal. It works very weirdly in my mac. Do all your practice in it. You can run it using the following:
docker run -d –name=gateone-2 -p 443:8000 arush/gateone
You should be familiar how copy paste etc work in the environment you will be doing the exam. (I was using a touchpad mouse on my imac but on 2nd trial physical mouse with click buttons worked much better). Otherwise you will be distracted with it and loose time.
You should know your editor (VI / Nano) and MOST IMPORTANTLY:
tmux , you will need to look into multiple files at the same time and you only get one terminal. I can’t imagine being able to answer some of the hard questions without tmux. TMUX is cool ! I was a
screen user before, but now I am a
ALSO MUST: Know your systemd , systemctl , etcd , journalctl , ssh , ssl (all covered in kubernetes the hard way)
TIP#3: Know your copy/paste (Dont’) , just use the Notepad
You have to copy paste across tmux window , VI etc. On my 1st attempt, I tried to do it all in terminal (My confidence with vi/tmux bite me). But you should be able to do it all with the exam NOTEPAD. Type everything there and paste in the terminal. That way you can also reuse the snippets / commands. Trust me, when you have got 30 mins left to answer 40 points, your supersmart vi/tmux tricks flies out of window. Just stick to the basics.
TIP#4: TIME is of the essence
The exam is not about your knowledge, its all about skills and efficiency. I am sure of all the people who fail CKA, 50% more would pass if they had 4 hour instead of 3 hour for the exam.
- You get 180 mins to finish 25 question.
- Out of those 25 question, 30% of the points are in 5 question and you need at-least 1 hour to answer them.
- That means you need to finish the rest of 20 questions in 120 mins.
- You will do some f***up in some questions, allocate 15 mins (if you are lucky) for troubleshooting. That leaves you (120-15) = 105 mins to answer 20 question.
- So roughly 5 mins per question.
- Imagine that! Create Resource, edit resource, save result, do basic test for that resource. All in 5 mins. Go get yourself a stopwatch and try to run a deployment in 5 mins.
TIP#5: If you get stuck, move on.
On my first attempt, I tried to make sense of a early question for 5-10 mins on a 2 point question and had to leave a few questions in the last unanswered. Remember you goal is to answer about 85% of the questions right, not 100%. On my 2nd attempt, I answered 92% in 135 mins. I could probably finish the last 8% in 30 mins (it was extremely tough) but I decided to play it safe and use the time to revisit some of the answers I had doubt about. I think I would have lost 6-10 points if I didn’t revise the answers / re-read the questions. I was quite confident I’d get at least 90%, not sure where I lost the 4 points, I still think about it 🙂
TIP#6: Strategise your learning activity
Again, the goal here is to answer 85% properly and get about 80 points. I spent most of my time going over each and every line of K8s Docs . I wish I had spent some of that time for practice.
I was over confident and didn’t attempt any practice exam. Didn’t time my activities, that was probably the biggest mistake I made on 1st attempt. Remember about 60% of the answers you can do quite easily if you did basic prep. You should prep for them really hard and practice practice practice, you should knock them off like within 60-70 mins.
DO NOT fall into the trap of having access to k8s docs and you can copy/paste. For simple things, you should not even think, just type the cammands from memory.
Rest 20-25% are medium difficulty but if you gone over the k8s docs and know where to look for reference + PLUS you have done kubernetes the hard way, you should be able to answer them too. I think they reserve 10% for the top 1 percentile, you will need a lot of practice and hands on k8s setup etc to get them and tobehonest, in this era of EKS / KOPS etc, I think my time is better used elsewhere.
- Was the prep painful and time consuming but LOTS of fun ? YES!
- Is there any easy / shortcut to pass ? NO!
- Do I think I wasted a bit of time for the cert that I could invest learning other stuff given I already have prod k8s running? Yes.
- Do I wish the exam was more of a test of knowledge (like you need to write a custom schedular, writing CRDs etc) rather than the test of speed ? YES !
- Is most of the things I learnt in the process of the exam useful for my day to day k8s activity (writing helm charts, investigating / customising other peoples’ helm charts, debugging logs) ? NO!
- Would I find it much more useful when I started k8s prod deploy about 1 year ago? YES!
- Would I DO it again ? YES !!! ….. Just for the CKA Walk 🙂