Kubernetes For Developers

A blog about how to get certified as a Kubernetes developer (CKAD) with handy tips and tricks allong the way

Intro

I was lucky. I had already extensive knowledge of Docker before starting the certification for Kubernetes developer (CKAD), and I have an employer (Ordina) that gives me the space and time to invest in myself.

So I claimed a week of preparation and did the whole Kubernetes for Developers (LFD259) course. In order to follow this course you have to prepare a practice
environment and they give you instructions on how to do that on AWS or Google Cloud (can result in extra costs). It is also very possible to create a cluster on your own machine. To make my life easier (and cheaper) I opted for the last option and created a vagrant setup for it here.

The LFD259 course covers everything needed for the certification, and it is created by the organisation also responsible for the certification exam. Much of the course is self study and reading. One of the downsides of this course was that if something went wrong, and you had a question you had to ask it on a forum and responses to that forum could take a long time.

So to prepare myself even more I bought the Udemy course Kubernetes Certified Application Developer (CKAD) with Tests. Normally this course is about $200,= but I bought it in a bundle (with Kubernetes for Administrators - CKA) for about $35,= A good deal as far as I am concerned. Udemy excels in video courses and that visualisation made the needed knowledge complete.

A nice extra of the Udemy course was that it came with prepared exercises on KodeCloud. Very nice! and with practice exams and lightning labs.

After a week of following courses and practicing a lot I scheduled the exam. In all honesty I was quite nervous. I scheduled my exam a week later for some extra practice and that is what I did.

Practice practice practice. Speed is what you need. All the blogs I read stressed that point, and I concur πŸ˜„.

Tips & Tricks

I have created a GitHub page with al the resources I used, with an extensive list of tips and tricks.

Practice for speed!

The biggest challenge is getting it all done within the allotted time. You have to complete 19 questions in 2 hours and in that time you have to write yaml files and edit them in one of the basic linux editors (vi / nano). I recommend investing in vi knowledge as it is much more powerful than nano.

The mentioned udemy course has a few lightning labs at the end of the course. If you can finish them within the given time you are very good on track.

Use kubectl over yaml as much as you can

Yaml is a pain to write and cut and paste can be a hassle with mixed tab and whitespace characters. So much can go wrong here!

Please don’t write yaml files from scratch!

Use kubectl run with the dry-run (--dry-run=client -o yaml) option whenever you can to at least generate as much of the yaml as you can. Practice this a lot and find more options.

1
2
3
4
5
# this is much faster
kubectl create deploy mydeploy --image=nginx --port=80 --replicas=4
#than
kubectl create deployment mydeploy --image=nginx --port=80
kubectl scale deployment mydeploy --replicas=4

and if you need to ad more options not provided from the commandline use the dry-run:

1
2
3
kubectl create deploy mydeploy --image=nginx --port=80 --replicas=4 --dry-run=client -o yaml>mydeploy.yml
vi mydeploy.yml
# edit what you need done and apply/create

Create a good set of bookmarks

You are allowed to have the kubernetes.io docs open in a second tab during the exam and this is powerful stuff. Create an extensive set of bookmarks pointing to all the needed examples. I have exported the bookmarks I used during my exam, and it was pure gold! Very useful.

Use bash to the fullest

Typing --dry-run=client -o yaml is very cumbersome every time you want a dry-run to generate a yaml but by putting it in a variable it becomes easy.

1
export DR='--dry-run=client -o yaml'

Now if you want a dry run you can just do:

1
2
3
kubectl create deploy mydeploy --image=nginx --port=80 --replicas=4 $DR >mydeploy.yml
#or
kubectl run hello --image=busybox $DR>hello.yml

This is just very basic stuff but saves a lot of time.

If you want to get more fancy do more!

1
2
3
4
5
6
7
8
9
source <(kubectl completion bash)
#setting the namespace (just do this one again for another namespace if needed)
export NS=default
# You will do dry runs often and now you can just type $DR in stead of the whole thing
export DR='--dry-run=client -o yaml'
# use k to run the kubectl command in the exported namespace. Saves typing
alias k='kubectl -n $NS'
# Now get code completion on the 'k' commands
complete -F __start_kubectl k

Now this is a setup made for speed πŸ˜„!

You kan use k in stead if kubectl with bash completion (tab) on the command, and you can make it into a dry-run by just adding $DR to it. If you have to perform multiple commands on a different namespace just perform this command first NS=otherns and use k again as normal. All this demands practice, because you must not forget to change back to the default namespace again when needed, but they can be great time savers.

Useful resources