YS Learns..

daily tinkers with software, infrastructure, coffee, running and photography

Passing the CKAD Exam

#ckad, #certification, #kubernetes

2020 has been quite the year with everyone working from home, having all the time in the world yet having no time at all. I finally took some time off work and decided to get started on some certifications I’ve been meaning to do, starting with CKAD, or the Certified Kubernetes Application Developer certification.

Exam Format

This is a practical exam (i.e. not multiple-choice) with 19 problems to solve in a 2 hour window. The exam is remote (what’s new in 2020?) so you can take it comfortably at home any time of the day. I did mine at 10pm on Christmas day. The topics tested in the exam and their respective weights are below and you should ideally have had experience with actual clusters so this isn’t a textbook exercise.

Topic Weight
Core Concepts 13%
Configuration 18%
Multi-Container Pods 10%
Observability 18%
Pod Design 20%
Services & Networking 13%
State Persistence 8%

You are allowed one extra browser tab to access either the official K8S docs, their blog or GitHub repo. The latter two are not useful for the exam so focus on the docs.

Since there are multiple ways to arrive at the correct answer, you will not get your results instantly and will have to wait up to 36 hours to find out. Mine arrived in 35 hours and I hope they’re not marking this with humans? Anyway, I scored 94% on the exam so I thought I should share my experience, as many others before me did.

alt text
My CKAD certificate

Preparing for the Exam

This exam assumes some level of experience with a Linux shell and Kubernetes itself. So while you can get the curriculum delivered in a course and some basic practical experience in a lab environment, you might not fully understand what you’re doing. The exam will then feel like lots of curve balls being thrown at you.

I used the CKAD with Tests course on Udemy (SGD 19.98) as a refresher since I don’t use every feature of K8S on a regular basis. The course comes with free access to a lab environment and 2 mock exams so it’s definitely good value for that price. There’s also a section called Game of Pods that sounded really fun to solve, but it’s somewhat broken, having been designed for K8S 1.14.

After completing the course, if the mock exams felt difficult, practice more in a cloud environment (or build your own on-prem cluster). You should be able to comfortably answer every question (with help from the docs) on this fairly comprehensive list of exercises by @dgkanatsios.

Exam Pro Tips

Physical + Virtual Environment Preparation

Ensure your desk is completely empty and you only have a glass of water in a transparent cup. Your browser needs to have a screen-sharing extension that can possibly fail (happened to a friend) so prepare a backup browser and sync your bookmarks. Exit every application you can and disable all notifications (focus assist in Win 10). You don’t want the proctor to unnecessarily stress you out by these things that can be easily prepared.

Picking Questions

I completed all questions ahead of time (1.5h out of 2h) but I know many people were struggling with time management. The exam platform has a flag feature so read every question completely and assess the difficulty. Some questions take less than 5 mins to solve and you know exactly how to proceed whereas others are really complicated with multiple steps and resources. Flag those difficult ones and skip them for later, making sure that you lock in your score for all the easy questions first.

Shell Preparation

Prepare the exam console to make yourself efficient. I am very used to typing k instead of kubectl and I obviously do not remember how to setup auto-complete. This is on the official docs but I chose to just memorise these lines to start off the exam with. I’m familiar with vim so that was my chosen editor and it needed to be primed for YAML editing/debugging so adding line numbers and tab-to-space expansion was really helpful.

alias k=kubectl
source <(k completion bash)
complete -F __start_kubectl k
printf "set number\nset tabstop=2 shiftwidth=2 expandtab\n" > .vimrc

There are some vim features that came in handy as well which I rarely used before.

v  - begin visual selection
d  - cut selection
y  - copy selection
p  - paste
>> - indent out (also 4>> to indent next 4 lines out)
<< - indent in

Imperative Commands

Do not ever write YAML from scratch. Use the imperative commands to output basic YAML and edit that file before doing a kubectl create -f hello.yml

# Pods
k run pod-name --image=nginx --dry-run=client -o yaml > hello.yml

# Pods with custom command
k run pod-name --image=nginx --dry-run=client -o yaml -- sleep 3600 > hello.yml

# Deployments
k create deploy deploy-name --image=nginx --dry-run=client -o yaml > hello.yml

# Creating a service - much faster than copying boilerplate
k expose deploy deploy-name --name=my-service --type=NodePort

# Update the image on a deployment - alternative to `k edit deploy`
k set image deploy/deploy-name container-name=image:tag

Bookmarks

You are allowed to browse the K8s docs but do not waste time actually browsing. Bookmark all the pages where you know you will be copying YAML boilerplate from. These were the bookmarks I used:

Copy/Paste

One of the most annoying parts of the exam: you can’t copy/paste the normal way. I had to do Ctrl+Insert to copy and Shift+Insert to paste on my Windows 10 PC. Ctrl+Shift+V also worked as paste for me so I preferred using that. The questions come with all the keywords like namespaces highlighted and they are copied once you click on them. Use these at every opportunity instead of manually typing anything by hand and risking a typo.

Verifying Your Answers

I scored badly on the mock exams because I did not read the questions carefully - missing out steps, making typos etc. Once you finish creating or editing your resource, do a describe and grep for a keyword to confirm the task.

k describe deploy my-deploy | grep -i image # or liveness, env, mounts etc

# if you want the entire output but with this keyword highlighted
k describe deploy my-deploy | grep -iE "image|$"

Split Screen with tmux

You only get 1 console and it can come in handy to inspect a resource while editing another. Enter tmux where you can get additional concurrent consoles. This was available in the exam console without any additional installation.

Shortcut Operation
Ctrl+B, % New console - split horizontally
Ctrl+B, " New console - split vertically
Ctrl+B, Arrow Jump to console in arrow direction

This one is optional and you can probably get by without it. Just a nice-to-have if you don’t mind memorising the additional shortcuts.

Good Luck 🍀

I hope this short guide was useful to you as did many guides I read and watched were useful to me. If you have any other questions, feel free to reach out to me via any social channel listed at the bottom.


Yong Sheng Tan

Written by Yong Sheng Tan from sunny Singapore

Twitter  ·  GitHub  ·  LinkedIn

All thoughts, opinions, code and other media are expressed here in a personal capacity and do not represent any other entities or persons