CKAD certification

My CKAD preparations

Danila Varatyntsev
3 min readDec 28, 2021

--

Today I received my CKAD certificate with 91% score. I started getting prepared for the certification a month and a half ago. In fact a month is more than enough if you have some experience with k8s.

How I got prepared:

  1. The best Udemy course. It contains some practical tasks, that give you understanding of what to expect from the exam.
  2. Sample test from killer.sh. I got it as a bundle when I purchaised certification pass on linuxfoundation. The test is much more difficult than a real exam and you get 2 attempts on it, even if you completed the first one successfully.
  3. Using k8s on a project for a bit.

The exam itself isn’t difficult, because you are allowed to read documentation (kubernetes, kubeblog, helm) and copy parts of yaml files from it. The main problem is time, you only have 2 hours to complete 15–20 practical tasks (I had 17). Each task is a scenario where you have to fix some broken resource or create a new one. Many scenarios require interaction with several resources.

To reduce the time you spend on each task, you have to know imperative commands:

  • kubectl run <name> --image <image> — run a single pod
    - --labels=k1=v1,k2=v2
    - --env=k1=v1 --env=k2=v2
    - --command -- <cmd> <arg1> <arg2> - override command
    - -- <arg1> <arg2> - override args
    - --restart=[Always | OnFailure | Never]
    - --[requests|limits]="cpu=100m,memory=256Mi"
    - --port <port>
    - --image-pull-policy=<>
    - --rm - delete resources created in this command. Useful for temp container that just sends curl command
    - -i - bind stdout in any case. Useful for temp container that just sends curl command
  • kubectl create deployment <name> — create a new deployment
    - --image=im1,im2,im3 - to run multi-container
    - --port=<toExpose>
    - --replicas <num>
  • kubectl label [-f <file> | <type> <name>] <k1=v1> — put a label on resource
  • kubectl delete [-f FILE | TYPE [NAME | -l k1=v1,k2=v2 | --all]] — delete pods
    - --force --grace-period 0 - kill immediately
  • kubectl create secret [generic | docker-registry | tls] <name> — create a secret. Usually you need to create a generic
    - --from-literal=key=value
    - --from-file=file
  • kubectl create job <name>
    - --image=<image>
    - --from=<cronjob>
    - -- COMMAND args
  • kubectl create cronjob <name>
    - --image=<image>
    - --schedule='...' — cron expression
    - --restart=[OnFailure|Never]
    - -- COMMAND args
  • kubectl expose (-f FILE | TYPE NAME) - creates service for pod, deploy, replicaset, replication controller
    - --cluster-ip='' - ClusterIP to be assigned, autoselect by default
    - --labels=k1=v1,k2=v2
    - --load-balancer-ip=<ip>
    - --name <name>
    - --port <port>
    - --protocol <protocol>
    - --target-port <port>
    - --type=[ClusterIP | NodePort | LoadBalancer | ExternalName]

Also you should use aliases and autocompletion. I used the offical guide that I opened after the start of the exam, but with slightly different aliases:

n=namespace_name # to switch between namespaces fast
alias k='kubectl -n $n' # single quotes are important and can't be replaced with double quotes
alias a='k apply -f'
do="--dry-run=client --output=yaml" # to use k run nginx --image nginx $dro > file.yaml

Vim shortcats that I used during the exam (I studied other but I forgot them just when the exam started):

  • dd — Deletes the whole line
  • 5dd — Deletes 5 lines
  • yy— Copies the current line.
  • 9yy — Yank current line and 9 lines below.
  • o — create a new line under current
  • O — create a new line above current

--

--