Whether you’re a seasoned DevOps professional or you just stepped into the world of containerization and their orchestration, you must have heard about K8s.
Right, I am talking about Kubernetes! Well, in 2019, It needs no introduction, Oh, I mean it might need though perhaps as to what it does or how it does, but considering the exploding adoption of kubernetes, it is commonly known as de facto tool for container management.
If you’re also interested to take the CKA exam in the future or just thinking about it then let me share some preparation tips with you which helped me to score ‘91%’ in my first attempt.
Well, you must be wondering how this guy is going to explain about cracking the exam in 7 days which is known as one of the toughest exams out there. Indeed below tips will help you to crack it, however, I would request to visit the below mentioned prerequisites first and see if this is something you’re comfortable with especially those who are just beginning to learn about Kubernetes.
- Understanding of YAML files.
- Experience with vi editor (copy and pasting text might be harder for beginners but practice makes it better). You will find a bunch of stuff on the internet for vi editor shortcuts.
- Working with Unix commands (for example, alias kk=kubectl so that you can write ‘kk get pods’ or ‘kk get nodes’). This will help you to save some time as every minute and second is crucial.
- Working with browser terminal (well, this will not trouble you a lot but having a practice on that will certainly help, try Katacoda). Katacoda K8s playground platform would be best to start getting your hands dirty.
- Get an understanding of Kubernetes terminologies.(pod, deployment, services etc.) This will help you to get a quick overview/refresher.
- One week availability to just eat, drink and dream about this wonderful technology (Of course you can eat your regular food :)) Needless to mention, willingness and strong determination to prepare for the D-day is extremely vital.
- Working hard and stay focused (that’s the key to achieve any goal for that matter)
Lets dive into our Day plans once above prerequisites are met.
Day 1: Start loving Official k8s docs (kubernetes.io)
You’re only allowed to access official kubernetes documentation (kubernetes.io) during the exam so having a great familiarity of documentation is vital especially to know where to look up what. (Of course, docs search for the specific keywords fetches all the relevant topics (from the different sections like tasks, references, and concepts) but you should know which one is the right pick for you as you don’t want to waste any time in the exam in searching out.)
Also, Make sure you’ve a reliable internet connection and a private workplace to take the exam. It’s worth going through the instructions briefly which is given in the Exam handbook and make sure you’ve all set to fly:) Check the k8s version your exam will run on and remember to study the docs of that version.
Day 2: Extensive hands on with Kubectl commands and understand Kubernetes objects
Use kubectl to create resources like pods, deployments, services, cronjobs etc. You can create most of the resources with one-liner kubectl commands on the fly instead of writing the whole YAML manifest file by hand which can be time-consuming and erroneous.
For example, create Pod with command:
kk run nginxpod --image=nginx --restart=Never
Create Deployment with command:
kk run nginxdeploy --image=nginx
Create DaemonSet (just edit the deployment YAML)
Modify kind to ‘DaemonSet’
Modify apiVersion to 'apps/v1'
Remove replica and strategy fields.
Finally run the create command
kk create -f myds.yaml --validate=false
You may definitely need to create resources which can not be done with imperative commands like above but you can save the output to a YAML file (for deployment, pod etc.) so that to get an initial manifest file which you can edit further based on the requirements.
kk run nginxdeploy --image=nginx -o yaml > nginxpod.yaml
To create YAML objects from stdin, having below command handy is useful.
cat <<EOF | kubectl create -f ----
Check this official resource for extensive list of kubectl commands.
Day 3: Clear your Concepts and Get your hands dirty with KTHW
Reserve a day to do KTHW (Kubernetes the hard way), Though you will take the long route to bootstrap a K8s cluster but in the end, you will learn quite a lot. You can make use of 300$ free credit for Google Cloud platform and practise KTHW over there without paying anything.
Don’t spend too much time on doing KTHW. Just doing it once and another time (with breaking out something and fixing it) is enough. If you follow all the steps nicely then it should not take more than 2 hours to bootstrap the whole cluster for one go. Next time, try to break the cluster and fix it, this way you will gain some more insights.
Get an idea about systemd unit files and journalctl commands and how to troubleshoot them. Basically below commands will be extremely useful
systemctl enable <service_name>
systemctl start <service_name>
systemctl status <service_name> <-- quite handy to look up for location of the systemd service file
Make sure you’ve no doubts related to any kubernetes objects and their objectives. Minikube tutorials are extremely useful to comprehend most of the concepts and to learn kubernetes interactively. By now you should be very confident about the understanding of pods, deployments, different type of services, volumes, persistent volumes etc.
You can also try these scenario based tutorials on Katacoda
Note: Please click the underline words to open the link in a new tab
Day 4: Explain command is your friend when you’re in trouble
Let’s say you forgot the object specifications fields such as livenessProbe for the containers. Of course, you can search for documentation for the help but a quick way to figure this out with the explain command.
kubectl explain pod.spec | grep -i livenessProbeDid you find it out , No ? then try to do a bit more diggingkubectl explain pod.spec.containers | grep -i livenessProbe
livenessProbe <Object>Bingo!!So now you know where the field exists which you were looking for
or if you’re not a fan of command line then peeking into API documentation is the best thing to do. You can summarily look into YAML fields and specs of any kubernetes objects like cron job, deployment, pod, replica set, config map, volume etc. So spend this day in troubleshooting, understanding describe command output and checking logs in case of failures etc.
Day 5: Practise, Practise and Practise
It’s very important to practise multiple times the kubectl commands and editing YAML files so that you get the complete hang of it. Once you do this several times I am sure you will get to learn new things every single time and get more and more familiarisation with the objects specifications and fields.
At the end of the day, you will hardly feel the need to look at the documentation because when you’re in trouble or not able to figure out something, these kubectl extensive commands will get you the required information on the fly most of the time.
Day 6: Check your speed and timekeeping
Honestly speaking, if you want to maintain the speed without wasting much time then don’t try to depend on documentation all the time. Try to remember important things by heart as there will be multiple clusters to switch around and time is of paramount importance over there.
Practise to create the k8s objects with the maximum speed possible and make sure the amount of time taken is decreased every time.
Some people prefer to practise on tmux editor, but I really don’t feel the need for it.
Make sure to sleep well before the exam day.
Day 7: D-day, Exam day
It’s time to roll up your sleeves. Keep calm and showcase your talent. Don’t get nervous, take it easy please. Have some food and be well hydrated before the exam.
Try to complete those questions first you’re more comfortable with and spend less time on that (not more than 5–7 mins.) Let’s say try to complete 10 easy questions in the first hour, another 8–9 questions in the second hour and the remaining most difficult ones in last hour.
Make use of the built-in notepad given in the exam to write down the questions you plan to attempt afterwards. But don’t spend much time in writing and calculating the score you completed so far, just keep yourself focused and if you’re stuck leave a note on the notepad so that you can come back later to solve it.
Don’t worry, If you don’t pass it. Remember you’ve one free chance to give it a try again and I am sure with hard work and a lot of practise it’s not difficult to get there.
All the best!
If you like these preparation tips then please clap and follow me:)