Passing the Certified Kubernetes Application Developer (CKAD) Exam

My experience with studying and taking the CKAD exam

Passing the Certified Kubernetes Application Developer (CKAD) Exam
Changing a yaml file for a Kubernetes deployment using Visual Studio Code, image by the author

Last Friday, I took the Certified Kubernetes Application Developer (CKAD) and passed. The CKAD exam certifies that you can design, build and deploy cloud-native applications for Kubernetes. The Linux Foundation offers the exam.

I took the new version as the Linux Foundation refreshed the exam on 28 September 2021. Currently, the exam uses Kubernetes v1.22.

This article describes my experience and the strategies I used to prepare and study for the exam.


The CKAD 2021 Domain & Competencies

To pass the exam, you have to show that you understand the following topics. Behind the subject, there is a percentage that indicates the weight in the exam.

  • Application Design and Build (20%)
  • Application Deployment (20%)
  • Application Observability and Maintenance (15%)
  • Application Environment, Configuration, and Security (25%)
  • Services and Networking (20%)

In September, the Linux Foundation added some additional topics to the Application Deployment category. It includes using Kubernetes to install blue/green or canary deployment strategies. Another addition was using Helm to install and upgrade packages. For more details, see the Linux Foundation site.


My exam preparation

Several online resources help you prepare for the (CKAD) exam. You can use paid courses, but there are also a lot of free practice questions.

These are the resources I used.

Udemy Certified Kubernetes Application Developer course

The course I used the most was the Udemy Certified Kubernetes Application Developer course from Mumshad Mannambeth. The course is excellent, and Mumshad explains every topic in great detail. It also has a section with the new topics from the September refresh.

The real value for me was the included practice exams in combination with KodeKloud. Together with the online training, you get access to KodeKloud. KodeKloud is a virtual training environment that provides hands-on training in Kubernetes.

Training exercises by Dimitris-Ilias Gkanatsios

Dimitris-Ilias Gkanatsios created several training exercises that you can find on Github. I used these questions in combination with a local Kubernetes installation. You won’t find the new topics from the September refresh, but they are still very relevant.

Another set of exercises by Bhargav Bachina

Bhargav Bachina created another set of exercises that you can find on Github. I also used these questions in combination with my local Minikube environment.

Killer.sh exam simulation

When you register for the exam at the Linux Foundation, you get two free Killer.sh simulator sessions. Each session consists of 36 hours of access to a Kubernetes cluster, including 22 exam questions.

Killer.sh states that their exam is more challenging than the actual exam. I’m afraid I have to disagree. I think that they are both the same. The difference is that the killer.sh exam got 22 questions, while on the actual exam, I only got 17.


My study timeline

I started with the Udemy course, went through it from start to finish, and did all the practice labs. When I finished the course, I practiced the included mock exams several times on KodeKloud. I practiced them until I was able to get 100% and finish it in time.

After the course, I started the first killer. sh simulation and answered all the questions. The first time I could not answer them all and needed more time than the stated two hours.

I studied the solutions from Killer.sh and reiterated the topics in the Udemy course. I kept on practicing the online Github questions.

A couple of days before the exam, I started the second killer.sh simulation. Both sessions give you the same questions. I practiced it until I was able to solve all the questions within two hours.

I then took the exam and passed.


The exam

You take the exam by answering questions about scenarios that run on a couple of Kubernetes clusters. You use a web terminal that runs inside Chrome. You get around 17 scenarios with several sub-tasks that you have to fulfill in two hours.

Is the exam difficult? I don’t think so. Anyone who has some experience with Kubernetes can answer all the questions. You are allowed to use the Kubernetes documentation.

The real problem is time. You get two hours. This looks like a long time but it isn’t. To pass this exam, you have to be quick with the command-line using kubectl. You don’t have enough time to search through the documentation with each question.

The rest of this article focuses on how to improve your speed.


Improving Speed by setup the terminal

You complete the exam through a web-based terminal running in Chrome. So, it is wise to set up the terminal before you start answering the exam questions. Here are the settings I used.

alias k=kubectl

I use k as an alias for kubectl. This saves you a couple of keystrokes. The terminal on the exam already has this alias available.

I used Vim as text editor. My .vimrc looks like this.set tabstop=2
set expandtab
set shiftwidth=2
set nu
syntax on

It makes sure syntax highlighting and line numbers are enabled. It set the size of the tabs to two spaces and makes sure that spaces are used instead of tabs.

I also use the following two environment variables during the exam. I will show examples of how to use them later in the article.export do="--dry-run=client -o yaml"
export now="--grace-period 0 --force"


Improve Speed by using imperative commands

Typically, in your production Kubernetes environment, you use declarative commands. You describe the desired state of a Kubernetes object via a yaml file and send that file to the Kubernetes API using kubectl. The cluster takes care of creating the object and reaching the desired state.

Now, you can get a significant speed improvement for the exam by using imperative commands instead. Let me show you an example.

Say that we want to create a Kubernetes ConfigMap called MyConfigMap in the namespace fire that contains a key of database_host with the value 192.168.16.1.

Using declarative syntax you first have to create the following yaml file and apply it to the cluster. In this case, you have to remember which apiVersion to use and to format the file in the correct way.

A quicker way is to build the ConfigMap using imperative syntax. See below. A lot less to type and easier to remember.k -n fire create cm MyConfigMap --from-literal=database_host=192.168.16.1

You can not build all Kubernetes objects via kubectl. For example, you cannot create a persistent volume and a persistent volume claim. Take a look at the help of kubectl kubectl create —-help to see which objects you can build using the imperative syntax.

Combining imperative and declarative commands

Sometimes you get a task that you cannot complete using a single imperative command — for example, this question.

Create a pod called MyPod in namespace fire using the nginx:alpine image. Name the container in the pod MyPod-container.

We can create the pod using the following command.k -n fire run MyPod --image=nginx:alpine

Now, this would work but one thing that we cannot specify is the name of the container in the pod.

The solution to this is to create a yaml file by using the imperative command. See the example below. By adding the --dry-run=client argument, kubectl does not actually run the command against the Kubernetes cluster but validates the command. The -o yaml argument states that we want to export the command using the yaml syntax.k -n fire run MyPod --image=nginx:alpine --dry-run=client -o yaml > pod.yaml

This generates a file pod.yaml as shown below. Now, remember the requirement that the container should be named “MyPod-container”? In this file, we can change the name of the container and create the pod using k apply -f pod.yaml.

I used this technique with almost all the exam questions. First generate a yaml file using an imperative command, change the file according to the requirements and create the resource using apply.

I showed in the Terminal section that I created two environment variables called do and now. The first one, do contains --dry-run=client -o yaml. If we combine this with the imperative command for creating a pod we get the following. This again saves a couple of keystrokes.k -n fire run MyPod --image=nginx:alpine $do > pod.yaml

Deleting Kubernetes resources

Sometimes you need to delete a Kubernetes resource before you can update it. Deleting an object can take some time. Adding the arguments --force —- grace-period 0 will directly delete the object.

Combining this with the new environment variable now that we discussed earlier, we get the following command which saves another couple of keystrokes.k -n fire delete podMyPod $now


Skip difficult questions with a low rating

Some exam questions are more complex than others. Each question has a weight in the form of a percentage that indicates how much this question contributes to the exam score.

Try to answer as many questions as possible. This means skipping a question when it takes too much time. For example, when kubectl keeps complaining about syntax errors in your yaml, flag the question and continue with the next question.

You can always circle back if you have time left at the end of the exam.

Conclusion

I had fun with the exam and the course. I learned fascinating new things regarding Kubernetes from the course. If you have some experience developing applications that run inside a Kubernetes cluster, I am sure that you can also pass the exam.

The most important thing is to practice becoming quick on the command line when using kubectl. There are a lot of resources available that can help you practice. I am sure that if you invest the time and practice enough, you too will pass the exam.