August 13th, 2019

Certified Kubernetes Application Developer (CKAD) Exam Tips

Developer Support
Cloud Solution Architects

Premier Developer Consultant Julien Oudot provides guidance on taking and passing the Certified Kubernetes Application Developer exam.


As a Microsoft employee focused on Open Source Technologies, I recently passed the CKAD (Certified Kubernetes Application Developer) exam, which is a different kind of test compared to the Azure certifications that I was more familiar with.

First, diving into this Linux world can be intimidating when you are accustomed to using a UI and Windows commands. Fortunately, a few commands and tricks can help you navigate this new environment, and be more effective while taking this exam.

Secondly, the test is not composed of multiple-choice questions. It contains the following sections:

All answers are provided through the terminal, by creating Kubernetes objects, or by outputting data into text files (e.g. save the errors printed by a failing pod).

The test lasts 2 hours and there are 19 questions that you can think of as challenges.

Tools to Solve the Challenges

To be able to complete the challenges, what I used a lot during the test was:

  • kubectl explain <object_name>.spec – will show you what fields you can use when defining Kubernetes objects using YAML. It’s very convenient to know if a readiness probe should be declared at the pod level or at the container level. You can also add –recursive to display all lower levels fields rather than just the direct children. I tried to avoid the recursive option since it is really verbose.
  • The kubectl CLI reference page. During the test, we will not only work declaratively with YAML but also imperatively with kubectl. To make sure you use the right command, you need to be able to navigate quickly to this page. Because you can have only a single documentation page opened in the browser, it is important to be able to find it quickly. From https://kubernetes.io/docs/, click on Home – Reference – kubectl CLI – kubectl Commands – kubectl Commands Reference.
  • Search feature on https://kubernetes.io/docs/. I used the search feature to find examples of YAML definition. When searching just a couple of fields, kubectl explain might be enough, but when talking about volumes or config maps, it is sometimes easier to see a concrete example. That’s where I searched for the Kubernetes objects and fields I was interested in.

Must Know Linux Commands

I did not have to use advanced Linux commands during the exam. In a nutshell, what was needed was:

  • Output result of a command into a file.

Example: kubectl get pod > result.txt.

When I had to select only a subset from the result of the first command, I just copied the subset I wanted to select, and used echo to print and redirected it to the result file.

Example: echo “selected string” > result.txt

A more elegant way would have been to use some grep magic, but I was too rusty and too much in a hurry for this. If you are good with grep, it will save you time to quickly find the information you are looking for.

Example: kubectl describe pods <mypod> | grep –context=10 Events > result.txt

  • Know how to work with busybox container to investigate issues. Busybox images and reference documentation is available here: https://hub.docker.com/_/busybox. Particularly, once you open an interactive session, you need to be able to test communication with other pods.

Example: wget -O- POD_IP:8080 #

Save Your Keystrokes

The first few commands I typed when starting the test were:

  • export KUBE_EDITOR=nano – That is just a personal preference, but I had not used vi[m] for a while, so I preferred to use Nano. This KUBE_EDITOR environment variable is used when running the kubectl edit command.
  • alias k=kubectl – Of course, we end up typing kubectl a lot throughout this exam. Since the command is quite verbose, this alias is very convenient.
  • alias kx=”kubectl explain” – as said above, kubectl explain is a command that you will probably use a lot, so shortening it is recommended.

Then, to avoid the creation of YAML files from scratch, a huge time saver is the use of –dry-run -o yaml > myfile.yaml. This parameter can be added to any kubectl create/run command to output the YAML representation of an object, that you can then augment using Nano/VI. This is really useful when you don’t know the kubectl parameters to create the Kubernetes object with the specific options required in the question.

You can also use kubectl get <any_resource> -o yaml > myfile.yaml, then update the yaml file and finally kubectl apply -f myfile.yaml to change some settings of an existing Kubernetes object. Note that a faster command would be kubectl edit, but depending on the challenge, you might also need to create another instance of an existing object (but slightly different).

Finally, try to use the resource type short names as much as possible: svc instead of services, po instead of pods, rs instead of replicasets, …

Use Copy/Paste Carefully

Using copy/paste is not as straightforward as one might expect. First, there are different shortcuts if you take the test from a Windows environment (i.e. ctrl+c ctrl+v won’t work in the terminal and notepad). Instead, use ctrl+insert to copy and shift+insert to paste.

Furthermore, when copying examples from the doc into the terminal, chances are that formatting won’t be good. As we all know from working with YAML, it is really important that the right space is at the right place. So, a good workaround is to:

  • Copy the needed lines from the documentation to the notepad. Note that the number of characters that can be copied is relatively small, so you won’t copy and entire YAML file but rather a specific section.
  • Carefully review the formatting.
  • Paste the formatted content in your Nano/VI session window.
  • Review the formatting once again.

Technical Preparation

Beyond the tips and tricks covered above, it is important to be well prepared when taking this test. The good news is that all the skills needed to perform well are part of the following GitHub repository: https://github.com/dgkanatsios/CKAD-exercises. For me, it really was a gold mine and being able to complete each of these exercises was enough to meet the bar and pass the test.

Precision is as Important as Speed

Because this is a long test, it is very likely that you won’t have time to answer all questions, so you want to be as confident as possible that your answers are right. However, because you want to answer as many questions as possible, you cannot spend a lot of time validating your work. It will be your call to determine the appropriate level of validation.

For instance, in a situation where you need to fix a communication issue between two pods, if the initial symptom was an error message coming from pod A saying it cannot reach pod B, you want to make sure the error disappears at the end of the challenge but you might not want to create a busybox container to check that you can actually communicate between from pod A to pod B.

Conclusion

Passing this test is rewarding and it means you won the race against time. Being an advanced Linux user is not a requirement but being able to move fast with kubectl CLI and YAML definition is a must.

In my case, I did not have time to work on 5 questions and was quite sure it was too much left to meet the bar. It turns out that most of the questions I answered were right and I passed with a score of 72% (66% required).

Author

Developer Support
Cloud Solution Architects

Microsoft Developer Support helps software developers rapidly build and deploy quality applications for Microsoft platforms.

1 comment

Discussion is closed. Login to edit/delete existing comments.

  • beauclair nanfack

    Very nice. Thank you