DEV Community

Cover image for Tips and Tricks to Ace the Certified Kubernetes Application Developer
Sahan
Sahan

Posted on • Originally published at sahansera.dev on

Tips and Tricks to Ace the Certified Kubernetes Application Developer

I recently passed the Certified Kubernetes Application Developer exam and thought to share some tips and tricks that might come in handy if you are also planning to take the exam in the future.

📔 Background

About a month ago, I decided to learn more about Kubernetes as it would be really useful for the my current role. Prior to that, I was always fascinated by Kubernetes but never got the chance to work on an actual system that used it. I knew how it worked from a 10,000 feet view, but didn’t have an idea of core components, basic constructs and literally to be able to do anything with it.

Having taken the exam, I’m quite comfortable navigating through Kubernetes and now it makes sense when I’m doing something with it, rather than merely following some commands.

CKAD is a hands-on exam and managing your time is absolutely crucial. I hope you find the following tips useful✌️

🗒️ Summary of the exam

To summarize the key facts about the CKAD exam,

  • Passing score is 66%
  • 2 hours duration, comprised of 19 questions
  • Questions will have varying weights (from 2% - 13%)
  • You can also open only one tab to browse Kubernetes documentation
  • Remotely proctored

💻 Aliases and bash tricks

This is a really important first that I can’t recommend enough. I was using the full kubectl command during the study phase but later started using just k by setting up an alias when I was practising simply to cut down the time when typing commands.

alias k=kubectl
Enter fullscreen mode Exit fullscreen mode

Initially, it will take a few seconds to type this out but it will pay dividends throughout the exam. Here are a few more if you are interested. You don’t need to use everything in here though. In fact, I only used the above alias.

Feel free to mix and match the commands you are comfortable with 👍

alias kd='kubectl describe'
alias kr='kubectl run'
alias kc='kubectl create'
alias ke='kubectl explain'
alias kgp='kubectl get pods'
alias kgs='kubectl get svc'
Enter fullscreen mode Exit fullscreen mode

You don’t need to be a Linux guru to take the exam, but, remember you will do it in some Linux env. (potentially Ubuntu). So it helps to know a few basic Bash commands if you are coming from Windows.

  • cp - Copy files
  • mv - Move/Rename files
  • mkdir - Create new folder
  • ls - List files
  • rm - Remove/Delete files
  • grep - Search through text. Useful when you want to filter a list of pods. Eg: kubectl get pods | grep -i status:
  • Ctrl+R - To do a reverse search to find a command you have previously run

Extra tip: Use short names of resources whenever possible.

Not sure what are the short names? You can check it with kubectl api-resources command.

tips-and-tricks-for-acing-ckad-1.png

⌨️ Get a good grasp of VIM

I found having previous experience in VIM came in handy. However, you don’t need to be a master at it. Using nano would be fine too if you are good.

Take the time to set the following to your VIM profile before attempting any questions.

vi ~/.vimrc
Enter fullscreen mode Exit fullscreen mode

Add the following lines and save it.

set expandtab
set tabstop=2
set shiftwidth=2
Enter fullscreen mode Exit fullscreen mode

These commands will save you from having indentation issues and weird syntax issues while working with YAML files during the exam.

Here are some other commands that may be of help if you are not familiar with VIM.

  • / - Search through text. Also, use n to go to the next result.
  • dd - Delete a line
  • u - Undo
  • Shift+A - Go to the end of the line and enter the INSERT mode
  • gg - Go to the beginning of the file
  • G - Go to the end of the file
  • o - Go to the next line and enter INSERT mode
  • v - Enter VISUAL mode. You can select a block of lines with arrow keys or j and k keys. You can copy with y and paste with p . Also, you can indent a block with Shift + > to right and Shift + < to indent to the left

And finally, while you are in NORMAL mode you can type ZZ to quickly save and go back to the terminal without having to type :wq How cool is that? ⚡

☄️ Mastering the imperative commands

You would come across many questions where you would have to create pods, deployments, services etc. In such cases, don’t bother writing up YAML definitions from scratch - or even finding the relevant reference in the k8s docs.

You can save a lot of time by using imperative commands. For instance, if you are tasked to create a pod with nginx as the image, tier:frontend as labels with the port 80 exposed:

kubectl run tmp --image=nginx --labels tier=frontend --port 80
Enter fullscreen mode Exit fullscreen mode

Say you are asked to expose a deployment nginx with a NodePort service called nginx-svc,

kubectl expose deploy nginx --name=nginx-svc --port=80 --target-port=80 --type=NodePort
Enter fullscreen mode Exit fullscreen mode

But what if you can’t get everything included in a single command you can use the --dry-run=client -o yaml > tmp.yaml to export it to a file before creating the resource.

Oh btw, if you need to delete a pod quickly you can use the --grace-period=0 --force command to quickly delete them without waiting.

kubectl delete po <pod name> --grace-period=0 --force
Enter fullscreen mode Exit fullscreen mode

🤔 When in trouble

Pay attention to the weightage of the question and a rough idea of how long it will take you to solve it. I can remember, I was looking at a question that was quite long and had a fair bit of configuration to be done. But the weightage was only 2% 😆 I marked it down on the provided notepad and skipped it (you can also Flag a question). The next question was 4% and was really really easy! I hope you get the point.

💡 Don’t be afraid to skip and revisit questions.

If you forgot how something is placed in a resource definition, you can use kubectl explain <resource name> --recursive | less to find what you are looking for.

Another useful tip I can give you is, the kubectl <resource name> -h command. You can use it like so.

k run -h
Enter fullscreen mode Exit fullscreen mode

tips-and-tricks-for-acing-ckad-2.png

☝️ A note on clusters & namespaces

This is also a very important point you should pay attention to. At the top of each question, if you will be given a command to set the current context. Make sure to run it for each question as different questions will be in different clusters.

Another point is, pay attention to any namespaces in the given question text. Sometimes it will be worded within the question. Sometimes it will be at the bottom of the question as a separate note!

In a question where you will have to ssh into servers please make sure to remember (or note it down) which cluster and server you are in. And remember to exit out of it before going to the next question.

📄 Leverage the docs

In certain cases, it’s better to visit the docs than to spend time to figure out what needs to be done. For instance, if there’s a question on setting up a Persistent Volume, the question will also have a section to create a Persistent Volume Claim and to create a Pod to use that.

Go to the docs, type pv at the search bar and click on the link that says “Configure a Pod to Use a PersistentVolume for Storage”. And yes, you need to know where things are at within the K8S docs!

tips-and-tricks-for-acing-ckad-3.png

👟 Practice, practice, practice

Speed is key to the exam. Although you get 2 hours, it will just fly! 🦅

When you pay for the exam you will get 2 free mock exam sessions before sitting the real exam.

Meme on speed

As Jeremy Clarkson would say, "SPEEEEEEEEED!!!!" 😂

Here are some more exercises I used.

👋 Conclusion

Do you know what’s the hardest thing to do after the exam? waiting for the results! 🤣 It might take up to 24 - 36 hours to get your result. Here’s my certificate if you are interested.

tips-and-tricks-for-acing-ckad-4.png

I hope you found these tips helpful. Feel free to comment below if you have got any tips and tricks too! Good luck with your exam!!! 🎉

Top comments (2)

Collapse
 
itsnikhil profile image
Nikhil Taneja • Edited

Congratulations on achieving the certificate 🎉
I use kubectl zsh plugin which adds these alias for me github.com/ohmyzsh/ohmyzsh/tree/ma...

Collapse
 
sahan profile image
Sahan

Thanks Nikhil! I haven't used it before. But I don't think that would be allowed at the exam since it would be considered as an "external resource". Make sure to check their up-to-date guidelines: docs.linuxfoundation.org/tc-docs/c...

That being said, for anything outside the context of the exam (personal, work stuff) this plugin should be great!