Eitan Suez

2020.07.09

Preparing for the CKAD certification exam

In late June 2020, I took (and passed) the Certified Kubernetes Application Developer (CKAD) exam.

In retrospect, what can I share with you that might be useful, assuming your goal is to prepare, take and pass this same certification examination?

At a high level, the main concepts one must understand are:

Regarding configmaps and secrets, this includes how to set an environment variable from a secret or configmap, and this includes both the envFrom: and valueFrom: variants. Further, secrets and configmaps are valid types of volumes. So know how to configure both secrets and configmaps as volumes.

Regarding pods, you should know:

Regarding volumes, you should be aware of and able to configure different types, not just configmaps and secrets, but also emptyDir, nfs, and hostPath. There are other details about volumes you should get comfortable with, including storage classes.

But the list goes on:

And therein lies the difficulty of the exam. There’s just a lot to it. Luckily the list doesn’t go on forever, it is finite.

With practice, it does all sink in. And that’s primarily what I advise you do: practice a great deal over a compressed period of time. It’s uncanny how much better you get over a short period of time. Set aside the time and give yourself a deadline. I gave myself a week. I started on a Monday. On Friday I scheduled the exam for the following Monday, and spent the (entire) intervening weekend practicing. By Monday I was ready. I made sure I slept well the night before the exam.

Honestly I’m surprised that, not having touched k8s in over a week since taking the exam, I remember this much. :-)

One dimension of learning has to do with knowing how to verify that whatever you were instructed to create has been created, is in a good state, and is functioning as you expect. Sometimes verifying that something functions involves having to obtain a shell prompt inside a running pod and poking around in there.

A good exercise I recommend as you prepare, is:

Each time you are challenged with a kubernetes task (whether it’s to create a pod, a deployment, expose a service, etc..), don’t stop there: figure out how to verify that you’ve done it right, what commands can help you see state information? It could be something as simple as kubectl get pods --show-labels or making use of the -o wide flag, or just listing your volume claims to see whether they’re bound to the persitent volume you previously created.

Sometimes a brief listing with a few extra columns is a simpler to sift through compared to the output of the kubectl describe command.

But more importantly, asking yourself and learning in each situation exactly how to get at the information you need is not only useful, but necessary while taking the exam, both for analysis and troubleshooting purposes, and to verify that you completed the task you were given correctly.

You should know how to easily create yourself a pod for the sake of obtaining a shell prompt inside the cluster. Make sure this becomes second nature.

The Udemy course by Mumshad Mannambeth is designed to prepare you for the test. This was for me (and many others) the principal preparation tool. Kudos to Mumshad and all involved in the creation of this course.

My advice is: work through the course, then:

Don’t stop there: after conquering the Udemy course, you will likely not be “there” yet (you may be if you use k8s daily in your work, but this was not the case for me).

Set aside time to collect external resources: blog entries, github repositories with information, tips, and resources.

Here’s a blog entry that I found helpful. Don’t just read the blogs: exercise the advice, the tips you are given, incorporate them into your toolbox. People have done remarkable things in setting up resources for studying for this exam. For example, here’s a great resource I came across in the course of doing some of that homework.

Something interesting happens over time. You get better at things. You don’t just get the answer right, the familiarity increases to a point where things become second nature.

Each time something behaves in a way you do not predict is an opportunity to dig deeper and understand why, and gain a deeper understanding of how things work. Do this over and over again until there are no mysteries left.

Play, tinker a lot.

Setup minikube on your local machine so you can try things out ad-hoc. Or use your public cloud account to spin up a cluster for yourself. It’s wonderful and convenient to use the Udemy course practice tests as a means to get access to a k8s environment. But it’s much easier to have one at your disposal to try things out whenever you like. It’s all about building up your fluency.

Regarding test taking, pay attention to:

Here are some speed-related tips.

Aliases

k is easier and faster to type than kubectl.

But there’s a catch: in my experience, command completion did not always work when using k as a substitute for kubectl.

I also noticed that the choice of key/value separator (a space vs an equal sign) impacted command completion.

For example, this works:

kubectl create deployment --image nginx --<tab>

but not this:

kubectl create deployment --image=nginx --<tab>

Command completion is important to me not only for speed but also as a checksum that I am using my command correctly. Having said that, you should be prepared to complete the exam even without the aid of command completion. When I started my test, it wasn’t enabled. I turned it on using the kubectl completion command.

An alias can make short work of switching namespaces.

I didn’t go crazy with aliases. This is all I used:

alias k=kubectl
alias kns="kubectl config set-context --current --namespace"
export DR="--dry-run=client -oyaml"

Use kns by appending the name of the namespace you wish to switch to.

The DR (stands for Dry Run) environment variable above sure beats having to type --dry-run=client -oyaml each and every time. Place the above into your .bashrc and source it at the beginning of your exam. This is one of many tips I adopted after reading advice out in the blogosphere.

Here’s an example command that first sets the namespace to my-ns and then writes a deployment manifest to the console:

kns my-ns
k create deploy my-web-server --image nginx $DR

I discovered these and other shortcuts and suggestions while reading others’ blogs on the subject, all the credit is theirs.

Tips

Aside: about snippets

On my mac, I use alfred as a command launcher, but alfred also sports a clipboard history and a snippets feature. Using alfred’s snippets to paste yaml would shave even more time out of the tedium of looking up a template, but I chose not to use it, so as not to risk having that considered in some way cheating.

More Tips

One more thing about your ability to complete an exercise at a fast pace: the faster you get at this, the less pressure you’ll be under when you take the test. You’ll have time to check your work, go back to that difficult question and get that one right too.

Good luck, and I hope the above advice helps you.