Efficient tips to pass the CKAD exam
Tags: cloud, containers, ckad
Published: 2023-11-21 18:19:51

CKAD (**Certified Kubernetes Application Developer**) is the certification delivered by the Linux Foundation, to validate developer skills on Kubernetes.

First, you can use [Udemy course](https://www.udemy.com/course/certified-kubernetes-application-developer) to go through the program you need to know, taking notes on things you want to review.
it's a good way to go through the whole program. 
With Udemy, you have access to [Kodekloud](https://kodekloud.com) which is a simulator to practice alongside video lessons.

**Practice is the key**, you can setup a local Kubernetes cluster with [Kind](https://dev.to/jdxlabs/a-local-kubernetes-cluster-in-seconds-with-kind-31lc), and work on the [CKAD exercises](https://github.com/dgkanatsios/CKAD-exercises) to assimilate all the concepts you need to learn.

![Practice is the key](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5d8i7z8l0rt7mlo5dh1.png)

But you should know that **this certification is essentially a test of speed** and that it is absolutely necessary to train with a simulator close to the conditions of the exam, to not be surprised : [Killer.sh](https://killer.sh) (note that it's a little harder than the actual exam).

So you have the resources to be ready, now I will share some tips to gain precious seconds during the exam, because it will be very fast.

## Tips to be efficient during the exam

### Set shortcuts

Edit your ".bashrc" file with this values, learn them by heart, you will see in the next steps that they will be usefull :

```bash
# to speed up pods termination
export f='--force'

# to print values of resources
export dry='--dry-run=client'
export o='-oyaml'

# for context switching
alias kshow='kubectl config get-contexts'
alias kx='kubectl config use-context'
alias kn='kubectl config set-context --current --namespace'
```

### Context switching

With this simple commands you can navigate quickly between contexts and namespaces on Kubernetes (without any plugin required) :
```bash
# Show current context and namespace
kshow

# Select context "kind-kind1"
kx kind-kind1

# Select namespace "default"
kn default
```

It is very important to know this commands, you will need them for each new exercise on the CKAD exam. 
The first question to ask yourself, for each new exercise is : **"Which context and which namespace ?"**.

### Be very comfortable with Vim and Yaml manipulations

You will have to manipulate Yaml files pretty often.

For **Vim**, you have to handle copy/paste, and to switch between files, the `:e myfile` command is convenient, and you have to learn to switch between buffers.
Here is a [Vim cheatsheet](https://devhints.io/vim) that can help you.

You will have between 16 and 19 questions, depending on the exam. 
You can create a folder, and name your files like this : `01_pod.yaml` (01 being the question number), in order to find the files of the previous questions when needed.

### Handle your time

There is a flag system, if you are not sure, just flag the question and come back later.

You can do the things you know, even if it's incomplete. You will have a percentage of points based on each action you have done well.

### Learn to generate the manifest files, from imperative commands

To create a resource, get the informations :
```bash
k create deploy --help
```

Then, you can create the resource directly with imperative command :
```bash
k create deploy mydep --image=nginx --replicas=3
```

Or create it with the generated manifest file, like this : 
```bash
# Deployment example :
k create deploy mydep --image=nginx --replicas=3 $dry $o > 01_dep.yaml  # edit it
k apply -f 01_dep.yaml

# Cronjob example :
k create cronjob myjob --image=busybox --schedule="*/1 * * * *" $dry $o -- sh -c "date" > 01_cronjob.yaml  # edit it
k apply -f 01_cronjob.yaml
```

### Learn to search in the official documentation

You will have access to the [Kubernetes documention](https://kubernetes.io/docs), learn to navigate in it, by knowing the good keywords (for instance, "[cheatsheet](https://kubernetes.io/docs/reference/kubectl/cheatsheet/)", that might be helpful), and resources you can’t handle with `k create`, try to handle all the program with it.
Be careful, sometimes keywords are not obvious, for **services**, think to **expose**, for **secrets**, think to **credentials**, etc.

With **explain** you can have the complete list of parameters. If you need to find one, it can be complementary and easier to find than on the documentation :
```bash
k explain po.spec > po-spec
k explain po --recursive=true > po-full

k explain job.spec > job-spec
k explain job --recursive=true > job-full
```

### Learn to edit existing resources

Like this :
```bash
k edit deploy mydep
```

Or by extracting the yaml output :
```
k get deploy mydep $o > 01_dep.yaml  # edit it
k apply -f 01_dep.yaml
```

Be careful, it is not possible to edit specifications of pods directly, you have to destroy and create them again (except for some elements, like labels or annotations).

### Learn to execute temporary pods to launch commands

Like this :
```bash
k run nginx --image=nginx:alpine --rm -it --restart=Never -- curl https://www.google.com
```

Or (Busybox is faster) :
```bash
k run busybox --image=busybox --rm -it --restart=Never -- wget -qO- https://www.google.com
```

You will have to use **curl** or **wget** to check if your services are well exposed, you have to be familiar with this.

### Learn to find extra informations

Some commands will help you for that :
```bash
# Get extra informations, like exposed IPs for instance
k get po -o wide
k get node -o wide

# Get labels of pods
k get po --show-labels
```


### Accelerate the deletion of pods

You can gain some seconds by deleting a pod like that, to force deletion :
```bash
k delete mypod $f
```

### Learn the complementary tools

There are complementary tools that you must know for the certificate, like [Helm](https://helm.sh/docs) and [Docker](https://docs.docker.com/engine/reference/commandline/cli) (or [Podman](https://podman.io/docs), you have the choice, it's pretty much the same commands than Docker).
Also take the time to get comfortable with them.

The Helm documentation, with a convenient [cheatsheet](https://helm.sh/docs/intro/cheatsheet/) is allowed during the exam.

## Now, good luck !

At this stage, you have good tips to go fast at this test, ensure you are comfortable with all the notions of the program and it should be fine.

Remember, practice, practice, practice, for this exam, this is the key.