My two cents on passing CKAD in 2022

Kavindu Chamiran
14 min readOct 6, 2022

So I faced the CKAD examination in October 2022 and ended up getting 96% on the first attempt. When I purchased the exam in 2021, the exam interface was completely different compared to what I faced in October 2022. Since then, they have moved to the PSI Bridge platform, so you no longer have access to your bookmarks. You would get a Linux GUI virtual machine with a terminal and Firefox.

Honestly, this came as a big surprise to me, but I quickly adapted to the new interface. This article describes the tips, tricks, and shortcuts I followed to get the best out of 2 hours in the exam. These helped me to save a lot of time which I later invested to circle through the set of questions twice, checking and correcting my answers. Hope they would come in handy to you too in the exam and good luck!

First steps…

Buy the exam from Linux Foundation

Currently, the CKAD certification is provided by the Linux Foundation. For Cyber Monday, they had a promotion of both CKAD and CKA bundled together for a discounted price. So keep your eye out for promotions like that. Otherwise, you can purchase only the CKAD certification.

Purchase link: https://training.linuxfoundation.org/certification/certified-kubernetes-application-developer-ckad/

I would not recommend purchasing any training material on Linux Foundation. Just purchase only the certification. You can schedule the exam date within 1 year of the purchase date and it also includes one retake in case you don’t get through it the first time. It would also include 2 free exam simulator sessions on Killer.sh.

Buy the Udemy course by Mumshad Mannambeth

First of all, I am in no way affiliated with the author of this course. I am only recommending it because I bought and went through it myself to learn a great deal about Kubernetes and I can highly recommend it to anyone else who’s just entering the Kubernetes world.

Purchase link: https://www.udemy.com/course/certified-kubernetes-application-develope

Go through all the lectures and make sure to complete the provided labs under each topic. Take short notes to refer to before the exam day. The labs can be tried any number of times so feel free to fail. Keep trying until you are comfortable with the topic and able to get all the questions correct. Do note that even though some questions are multiple-choice in the labs, the actual exam will have no multiple-choice questions.

The labs will provide you with a good practice ground to improve your kubectl skills and vim skills, in addition to testing your Kubernetes knowledge. I will talk about several kubectl and vim configurations I used in the actual exam to save a bunch of time so make sure to try them in the labs to get them into your muscle memory.

The only negative feedback I have about the course is that the provided 2 mock exams (as of this writing) are too weak. Questions found in the actual exam will be much much difficult and time-consuming. The mock exam you can find in the Killercoda session is on par with the exam’s difficulty.

During the learning phase…

Configure these kubectl shortcuts before each lab

The following kubectl configurations will save you a few seconds from each command execution, which will add up to several precious minutes. Do note that the exam interface will come with the alias k and bash auto-completion for kubectl preconfigured.

alias k=kubectl // only required for Udemy labsalias ka="kubectl apply -f"alias kc="kubectl config set-context --current --namespace"alias kd="kubectl describe"alias ke="kubectl explain --recursive"export do="--dry-run=client -o yaml"export now="--grace-period 0 --force"
  • k: this will save you the time of pressing 7 keystrokes spent on each kubectl command. You only have to do this in Udemy labs. The actual exam will have this preconfigured.
  • ka: when you are creating a Kubernetes resource from a file, just type ka <filename>.
    Example: ka deployment.yaml
  • kc: when you need to change the active namespace in the current context, just type kc <namespace name>. More on this later.
    Example: kc production
  • kd: when you want to describe a resource, just type kd <resource kind/resource name>. You can combine this with grep too.
    Example: kd pod/nginx , with grep kd pod/nginx | grep -i image
  • ke: when you want to get the YAML definition of a resource kind, just type ke <resource kind>. More on this later.
    Example: ke pod.spec.containers.securityContext
  • do: export the YAML into a file from a kubectl imperative command without creating the resource. More on this later.
    Example: k create deployment nginx --image nginx $do > nginx.yaml
  • now: to delete a resource without waiting for it to happen gracefully.
    Example: k delete pod/nginx $now

Configure these vim settings before each lab

The following Vim configuration will significantly improve your YAML editing experience using Vim on the terminal. You need to be able to do it by heart in the actual exam. The exam interface will have some of the settings preconfigured but it doesn’t hurt to be able to do it from memory.

echo "autocmd FileType yaml setlocal et ts=2 sw=2 ai nu sts=2" >> ~/.vimrcecho "syntax on" >> ~/.vimrc
  • et: expand tabs — when you press the tab key on the keyboard, Vim will add 2 spaces instead.
  • ts=2: tab stop — add 2 spaces for each tab expand.
  • sw=2: shift width — auto-indent 2 spaces.
  • ai: auto-indent — enable auto-indentation.
  • nu: numbers — show line numbers in the editor.
  • sts=2: soft tab stop — when backspacing a tab, remove 2 spaces instead.
  • syntax on: enable syntax highlighting.

Kubectl tricks and tips

Changing context and namespace

In the exam, you will be required to switch between 4 clusters in different contexts. Each context will have questions that need to be performed on a specific namespace (default namespace unless otherwise specified).

You won’t get any marks if you execute the correct steps but in the wrong context or namespace. Before each question, you will be provided with the command to switch to the correct context but switching to the correct namespace is up to you.

Before attempting each question, execute the provided command to switch to the correct context. Then read the question to find out the namespace. You can click on the namespace’s name in the question to copy it to the clipboard.

Then type kc <space> and paste in the copied name, and hit enter. Then proceed onto answering the question. You can alternatively specify the namespace for each kubectl command using the -n parameter but it takes time plus it is easy to forget to specify the namespace every time, especially under exam stress. Do note that when you change the context, it won’t reset the selected namespace to default.

Changing context and namespace

Avoid documentation lookups as much as possible

You can refer to the Kubernetes official documentation in the exam. The exam interface will have a Firefox web browser that you can use to browse https://kubernetes.io/. You can use the search feature to search for a specific page. Additionally, the questions will include a set of links to related pages for the question. When you click on them, they will open in the browser.

This is great right? I don’t have to remember Kubernetes YAML at all! Well, no. Even though you open up the page, you will still need to find a suitable YAML example from the page which could easily eat up several minutes of your precious time. Even then, it won’t exactly satisfy the question’s requirement. My preferred alternative is to use the “kubectl explain” command to output the YAML specification for any Kubernetes resource.

Suppose you are asked to configure a readiness probe for an nginx pod, but you don’t exactly remember the required properties to configure the probe. You should have a rough idea of where the probe is configured in the YAML — pod → spec → containers → nginx container YAML object.

Execute ke pod.spec.containers.readinessProbe and it will output the list of properties required to set up a readiness probe. You can combine this with “less” too. Make sure to open the YAML file in Vim on one tab and execute the command on another. Then you can copy and paste keys from the second tab to your Vim tab.

“kubectl explain” will output the YAML specification

Edit existing Kubernetes resources in-place

In the exam, some questions may require you to edit an already existing Kubernetes resource to apply a different configuration. You can export the resource to a file, and then delete it, then edit the file and create a new resource from the file. Alternatively, you can edit the resource in place using the “kubectl edit” command.

This will open up the Vim editor with the resource’s YAML where you can make changes as usual. Once you save your changes and exit the editor, Kubernetes will apply the new YAML on top of the existing resource. Do note that there are a few cases where you have to delete the existing resource first before making any changes. You should know what those are by practice. Eg: You can’t make changes to an existing pod’s container’s args parameter.

Edit the nginx container’s args parameter in-place

Never write your own YAML from the scratch

If you are planning to memorize Kubernetes YAML syntax and type everything from the scratch in the exam, you will spend most of your 2 hours trying to debug the YAML content. Even copying and pasting YAML from the documentation takes time because you will still have to edit the copied content to match the question’s requirement.

You should use kubectl imperative commands to create Kubernetes resources. Copy YAML from the documentation only when you can’t create it using kubectl. Questions that require you to do so are extremely rare. Most of the time, you will be creating a partial YAML using kubectl, and then editing that to match the rest of the requirements.

Example: Create a deployment named “nginx” that runs the nginx:alpine image with 4 replicas. The containers need to expose port 80. The pods need to have a liveness probe that queries the path “/” for an HTTP 200 response every 10 seconds. The probe should wait 5 seconds initially for Nginx to start up. The deployment should be accessible over port 32000 on every node.

Yes, you can write up the YAML for a deployment and a service but that is all you will be doing for the whole 2 hours! Here’s how you do it in the shorted way possible.

  1. Create the deployment YAML using kubectl create.
  2. Edit it using Vim to add the liveness probe.
  3. Apply the YAML using kubectl apply.
  4. Create the service YAML using kubectl expose.
  5. Edit it using Vim to add the node port.
  6. Apply the YAML using kubectl apply.
kubectl imperative commands

The “$do” bit tells kubectl to only “dry run” this command (don’t actually create the resource), and output its YAML which you can redirect into a file. By practice, you need to know which properties can be specified using kubectl and which can not be. Refer to kubectl docs to learn more.

Vim tips and tricks

Use :set paste when pasting YAML from the documentation

When you are copying and pasting YAML from the documentation, Vim tends to auto-indent the pasted text and screw up the indentation. When you save the file and try to create a resource out of it, kubectl will throw a handful of errors. So whenever you are pasting content from the documentation, make sure to temporarily turn off the auto-indentation. You would still need it when you are typing and editing the file after pasting.

To inform Vim that you are pasting content now and you want it to look as same as the original, Go to the normal mode, then press “:” on the keyboard and type set paste, and hit enter. Then paste the content onto the editor. Then go back to the normal mode, press “:” again and type set nopaste, and hit enter to revert your previous setting.

Tell Vim to turn off auto-indentation temporarily

Use :retab when kubectl says indentation errors

After you edit a YAML file, you may screw up its indentation. Especially if its content was pasted from somewhere else. You might end up with a mix of tabs and spaces. When you try to apply the file, kubectl will say you have indentation errors, but if you open the file, everything looks perfect. The issue is that even though you see a line indented, it was indented with a tab instead of 2 spaces.

Go to the normal mode, press “:” and type %retab! and hit enter. This will convert all your tabs to spaces. Now save the file and try to apply it again. This time it should work.

Use ZZ to quickly save and exit

Suppose you are editing an existing Kubernetes resource in place. You have done the changes and you want to save them now. You can either execute the commonly used :wq command but you can save a keystroke or two by using the ZZ shortcut instead. Just press Shift and the Z key twice.

Miscellaneous tips

Mac users: bind ⌘ command key to ⌃ control key

This was a huge timesaver for me. As a Mac user, I am used to using ⌘+C and ⌘+V to copy and paste content. But in the exam interface, you have a Linux virtual machine and it does not respond to the command key. It will definitely be a pain for you to practice copying and pasting using the control key.

What you can do instead is switch the command key and control key bindings. Open the System Preferences → Keyboard → Modifier keys and switch the 2 keys.

Switching ⌘ and ⌃ in a Mac

Do note that you need to use ⌘+⇧+V to paste content onto the terminal. This leads me to my next tip.

Turn off “unsafe paste” warning in the terminal

When you are pasting content onto the terminal in the new exam interface, you would constantly get the following warning. Make sure to disable that warning at the beginning of the exam.

Unsafe paste warning when pasting YAML

To disable this, open the terminal, then Edit → Preferences → General, and at the bottom, uncheck the “Show unsafe paste dialog” option.

Turn off unsafe paste warning

Using multiple desktops

In the new exam interface, you are only allowed one display, but you can have multiple desktops! The Linux GUI supports up to 4 desktops, which you can switch between by clicking the icons on the taskbar. This is my preferred arrangement.

  1. 1st window: a full-sized terminal.
  2. 2nd window: a full-sized Firefox browser.
  3. 3rd window: a full-sized Mousepad editor.

If you want multiple terminal windows, open them as tabs on the single terminal window. The same goes for the browser and the text editor.

Configure Mousepad for editing YAML

Most of the time, you will be using Vim for editing YAML but if you are editing content you extracted from the documentation, using Mousepad for that would be easier as you will be changing multiple lines. First, configure Mousepad to edit YAML.

Set the file type to YAML. Go to Documents → Filetype → Other and select YAML.

Set file type to YAML

Then enable auto indentation and set the tab size to 2.

Enable auto-indentation

Now whenever you are extracting YAML from the documentation, paste them onto the Mousepad editor, then do your changes there, then copy again and paste them onto Vim on the terminal. Saving it to a file and trying to apply it on the terminal will not work as they use different storages.

Know basic Cron syntax

You might be asked to set up a cron job to run on a specific schedule. You set the schedule using cron syntax but the question will not tell you the cron. Most of the time, it will be something simple like “every minute” or “every 2 minutes”.

Know that * * * * * is the cron for the “every minute” schedule. Then the cron for every n minutes becomes */n * * * *.

Practice the scenarios on Killercoda

In addition to the Udemy course labs, there is a handful of interactive scenarios you can try out on Killercoda. I suggest you complete every scenario before the exam. After all, the terminal in Killercoda is very similar to the one you would see in the exam.

Killercoda CKAD scenarios

The Killercoda.com founder Kim Wuestkamp has a nice article on the new Exam UI. Please have a read.

There, you would find a Killercoda scenario that gives you a free Linux GUI desktop to get familiar with the actual desktop you would see in the exam. You must try that out and practice yourself setting up kubectl and Vim as you would do at the beginning of the real exam.

Check-in early on the exam day

Since the migration to the PSI bridge software, you can check in to the exam yourself 30 minutes before the exam start time. You need to download and install the PSI secure browser but the download button will only become active 30 minutes before the exam (you can’t download and install it a day or two in advance). So don’t wait until the last minute and be there 30 minutes early.

Sometimes, you may run into trouble while installing the software so make sure to read the installation guide relevant to your OS before the exam. Don’t have any other processes running during the exam period. This will slow down your computer and the PSI browser might not let you in until you kill those applications. Try to be on a fast, stable internet connection as you will be using a terminal running inside a GUI Linux virtual machine. The lesser the lag, the better the exam experience.

Conclusion

The exam is easy to pass as long as you know your stuff and you have practiced your stuff. Knowing Kubernetes is simply not enough unless you have practice because you will be fighting against time. On any other day, you can open your favorite text editor and write YAML and save them and apply them, at your own pace. But at the exam, that is not feasible. Always you must take the shorted path possible to achieve a result.

I still got to face the CKA in November. I will share an article on my CKA tips after that. See you in the next one and good luck with your exam!

--

--