1 of 45

CKAD Study & Exam Tips

https://community.cncf.io/manly

2 of 45

Agenda

2

https://community.cncf.io/manly

10 mins

10 mins

10 mins

Exam Tips

Study Tips

Practical Examples

Q&A Session / Discussion

15 mins

3 of 45

Special thanks

3

https://community.cncf.io/manly

https://kubernetes.io/docs/contribute/participate

SIG Docs

slack.cncf.io

slack.k8s.io

4 of 45

Exam Tips - Why sit the exam

4

https://community.cncf.io/manly

As one of the highest velocity projects in the history of open source, Kubernetes use is exploding. The Cloud Native Computing Foundation is committed to growing the community of Kubernetes-knowledgeable application developers, thereby enabling continued growth across the broad set of organizations using the technology.

Certification is a key step in that process, allowing certified application developers to quickly establish their credibility and value in the job market, and also allowing companies to more quickly hire high-quality teams to support their growth.

5 of 45

Exam Tips - Exam Curriculum

5

https://community.cncf.io/manly

  • 13% – Core Concepts
  • 18% – Configuration
  • 10% – Multi-Container Pods
  • 18% – Observability
  • 20% – Pod Design
  • 13% – Services & Networking
  • 8% – State Persistence

6 of 45

CKAD Certificate

6

https://community.cncf.io/manly

7 of 45

Exam Tips

7

https://community.cncf.io/manly

8 of 45

Exam Tips - Booking your exam

8

https://community.cncf.io/manly

To book goto: https://www.cncf.io/certification/ckad

  • Book exam straight away to set your goal

  • Free reschedule as many times as you want 24 hours in advance

  • Price is in US dollars

  • One free retake

9 of 45

Exam Tips - Discount Codes

9

https://community.cncf.io/manly

https://events.linuxfoundation.org/kubecon-cloudnativecon-europe/register

10 of 45

Exam Day

10

https://community.cncf.io/manly

Exam

Questions

11 of 45

Exam Tips

11

https://community.cncf.io/manly

  • You can start the exam 15 minutes before the scheduled time, this is the amount of time it will take to talk to the proctor.
  • Make sure that your room is clean on exam day, they will ask you to walk around the room with your camera
  • Nothing to be on the walls
  • Drinks need to be in a clear glass, toilet breaks allowed.
  • Don’t talk during the exam
  • Take note of how to copy and paste

12 of 45

Exam Tips

12

https://community.cncf.io/manly

  • There is a notepad you can use in the portal
  • The exam consists of 15-20 performance based tasks
  • Each question has a weight eg 5% skip hard ones and flag them for later
  • Straight away use sudo -i to assume elevated privileges to make things easier. If you want to get out type exit or su student
  • Use “ssh <Node Name>” to get into the node, remember which node you are in so you don't get confused
  • Always copy pod names etc instead of typing out to avoid spelling mistakes
  • Use imperative commands over YAML

13 of 45

Exam Tips - Naming YAML files

13

https://community.cncf.io/manly

When generating YAML files, name them with the question number

Example

1.yaml

1-svc.yaml

kubectl run example bradmccoydev/test:latest -o yaml > 1.yaml

cp 1.yaml 1a.yaml (backup if required)

kubectl create -f 1.yaml

14 of 45

Exam Tips - alias k=kubectl

14

https://community.cncf.io/manly

alias k=kubectl

Use this so you don’t have to keep typing kubectl all the time

Eg.

alias k=kubectl

k run nginx --image=nginx

15 of 45

Exam Tips

15

https://community.cncf.io/manly

Make sure you are in the right cluster, and the right namespace as specified in the question, to avoid deploying to the wrong namespace when using YAML to create resources specify it in the metadata in case you forget.

16 of 45

Exam Tips - kubectl api-resources

16

https://community.cncf.io/manly

kubectl api-resources to get names/short names eg. kubectl get svc

17 of 45

Exam Tips - Reverse Search (Ctrl + r)

17

https://community.cncf.io/manly

18 of 45

Exam Tips - Watch command

18

https://community.cncf.io/manly

Make use of the watch command when checking if deployments worked etc it will execute the command every 2 seconds until you ctrl + c eg watch kubectl get pods

19 of 45

Exam Tips - kubectl -h command

19

https://community.cncf.io/manly

Use the -h for help! kubectl run -h gives some hints if you forgot imperative commands under pressure.

Practice the -h command on other options such as kubectl create deploy -h etc

20 of 45

Study Tips

20

https://community.cncf.io/manly

21 of 45

Study Tips - Courses

21

https://community.cncf.io/manly

walidshaari/Kubernetes-Certified-Administrator.git

22 of 45

Study Tips - Use bookmarks!

22

https://community.cncf.io/manly

In the exam you are allowed to use bookmarks for the documentation so as you study and learn add bookmarks to the page in kubernetes docs.

When you do your practice tests and practical work, refer to the bookmarks and not your notes, this will help you be fast for exam day.

23 of 45

Study Tips - Use bookmarks!

23

https://community.cncf.io/manly

24 of 45

Study Tips - kubectl Reference Docs

24

https://community.cncf.io/manly

25 of 45

Study Tips - VIM

25

https://community.cncf.io/manly

If you don’t know VIM editor learn it. You can get away with just knowing nano, by setting KUBE_EDITOR=”nano” but when you need to edit deployments etc it will default to VIM so you don’t want to risk being stuck. If you don't know VIM you are not ready for you exam.

VIM Cheat Sheet: vim.rtorr.com

26 of 45

Study Tips - VIM

26

https://community.cncf.io/manly

There are two modes, for writing/deleting text press i, then press esc for edit mode

To exit without saving press esc and type :q!

To exit with saving press esc and type :wq!

To delete a line type dd

To delete more than one line type 5dd (substitute 5 for the number you want to delete)

To Goto line 5 type 5gg (substitute 5 for the number you want to goto)

To Jump to the end of the line type $

To search for a word eg image press esc then type /image and press enter

To show line numbers press esc and then type :set number

27 of 45

Study Tips - Basic linux commands

27

https://community.cncf.io/manly

If you are a developer doing this course and you are not used to linux, it is worth learning basic linux commands.

Command

Description

Example

cd

Used to go into or out of a folder

cd myfolder (cd .. to go back)

ls

List files/folders in a directory

ls (ls myfolder to list contents of myfolder)

grep

Searches for text

cat 1.yaml | grep image

cat

Read a file on the console

cat deployment.yaml

cp

Copy a file

cp 1.yaml 1a.yaml

mv

Move a file

mv 1.yaml backup/1.yaml

mkdir

Make a directory

mkdir test

rm

Removes a file or folder

rm 1.yaml (rm -R myfolder for directory)

vi

Go into vi editor

vi deployment.yaml

28 of 45

Practical Examples

28

https://community.cncf.io/manly

29 of 45

Practical Examples

29

https://community.cncf.io/manly

  • 13% – Core Concepts
  • 18% – Configuration
  • 10% – Multi-Container Pods
  • 18% – Observability
  • 20% – Pod Design
  • 13% – Services & Networking
  • 8% – State Persistence

30 of 45

Practical Examples - General

30

https://community.cncf.io/manly

Command

Description

kubectl get pods --show-labels

Show labels for pods

Kubectl get pods -l app=postgres

List pods that have the label app=postgres

kubectl get pods -A

Show pods in all namespaces

kubectl get all -n dev

Show all (most) things in the namespace dev

kubectl api-resources

Get names/short names for resources

kubectl run -h

Get help for kubectl

alias k=kubectl

Sets k as the alias for kubectl

31 of 45

Practical Examples - Core Concepts

31

https://community.cncf.io/manly

kubectl run -h

kubectl run nginx --image nginx --dry-run=client -o yaml > 1.yaml

kubectl run hazelcast --image=hazelcast/hazelcast --port=5701

kubectl run hazelcast --image=hazelcast/hazelcast --env="app=hazelcast,env=prod"

kubectl run hazelcast --image=hazelcast/hazelcast --labels="app=hazelcast,env=prod"

kubectl run hazelcast --image=hazelcast/hazelcast --command ‘sleep 3600’

kubectl run hazelcast --image=hazelcast/hazelcast --requests=’cpu=100m,memory=256Mi’

kubectl run hazelcast --image=hazelcast/hazelcast --limits=’cpu=200m,memory=512Mi’

32 of 45

Practical Examples - Configuration

32

https://community.cncf.io/manly

# Config Maps (cm for short)

kubectl create configmap myconfig --from-literal=username=brad

kubectl get configmap myconfig -o yaml

kubectl run test-pod --image busybox --dry-run=client -o yaml > 1.yaml

kubectl create -f 1.yaml

apiVersion: v1

kind: Pod

metadata:

name: test-pod

spec:

containers:

- name: test-container

image: busybox

env:

# Define the environment variable

- name: USERNAME

valueFrom:

configMapKeyRef:

# The ConfigMap containing the value you want to assign to USERNAME

name: myconfig

# Specify the key associated with the value

key: username

https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap

https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-em-configmap-em-

33 of 45

Practical Examples - Configuration

33

https://community.cncf.io/manly

# Secrets

kubectl create secret generic mysecret --from-literal=password=123

kubectl get secret mysecret -o yaml

kubectl run test-pod --image busybox --dry-run=client -o yaml > 1.yaml

kubectl create -f 1.yaml

apiVersion: v1

kind: Pod

metadata:

name: test-pod

spec:

containers:

- name: test-container

image: busybox

env:

# Define the environment variable

- name: PASSWORD

valueFrom:

secretKeyRef:

name: mysecret

key: password

https://kubernetes.io/docs/concepts/configuration/secret/

https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-em-secret-generic-em-

34 of 45

Practical Examples - Configuration

34

https://community.cncf.io/manly

# Service account

kubectl create serviceaccount my-service-account

kubectl get serviceaccount my-service-account

kubectl run test-pod --image busybox --serviceaccount='my-service-account'

https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/

https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#-em-serviceaccount-em-

35 of 45

Practical Examples - Observability

35

https://community.cncf.io/manly

# Get logs from pod

kubectl logs my-pod

# Get logs from pods with the name label myLabel

kubectl logs -l name=myLabel

# Output logs to console

kubectl exec my-pod -c my-container -- cat /var/log.txt (multi container)

# Go into the pod to look for the logs

kubectl -n your-namespace exec -it pod/your-pod -- /bin/sh

# Kubectl cheatsheet

https://kubernetes.io/docs/reference/kubectl/cheatsheet

36 of 45

Practical Examples - Observability

36

https://community.cncf.io/manly

kubectl top node

kubectl top pod

37 of 45

Practical Examples - Pod Design

37

https://community.cncf.io/manly

kubectl create deployment my-dep --image=nginx --replicas=3 --port=5701

38 of 45

Practical Examples - Pod Design

38

https://community.cncf.io/manly

# Rolling updates, and rollbacks

kubectl set image deployment/nginx-deployment nginx=nginx:1.16.1 --record

kubectl rollout status deployment/nginx-deployment

kubectl rollout undo deployment/nginx-deployment

# Jobs

kubectl create job my-job --image=busybox -- date

https://kubernetes.io/docs/concepts/workloads/controllers/job

# Cronjobs

https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs

39 of 45

Practical Examples - Services and Networking

39

https://community.cncf.io/manly

# Services

kubectl create service clusterip my-cs --tcp=5678:8080

kubectl create service nodeport my-ns --tcp=5678:8080

Kubectl expose deployment nginx --port=80 --target-port=8000 (--type=ClusterIP,NodePort)

# Network policies

https://kubernetes.io/docs/concepts/services-networking/network-policies/

40 of 45

Practical Examples - State Persistence

40

https://community.cncf.io/manly

# Host path example

https://kubernetes.io/docs/concepts/storage/volumes

If you can’t find something in the documentation remember you can use the kubectl explain command

kubectl explain pv --recursive

kubectl explain pod --recursive

apiVersion: v1

kind: Pod

metadata:

name: test-pd

spec:

containers:

- image: k8s.gcr.io/test-webserver

name: test-container

volumeMounts:

- mountPath: /test-pd

name: test-volume

volumes:

- name: test-volume

hostPath:

# directory location on host

path: /data

# this field is optional

type: Directory

41 of 45

Practical Examples - State Persistence

41

https://community.cncf.io/manly

We will do a separate talk on this as there is alot to cover

https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage

https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage

42 of 45

Conclusion

42

https://community.cncf.io/manly

Don’t be afraid to fail. I failed my first attempt but it gave me a good opportunity to see where I needed to improve, and passed on my free retake with a high score.

Learn the basics first, you will save time in the long run, learn basic linux, learn VIM, learn kubectl well.

If you are having trouble getting a test environment to practice with maybe your cpu, ram on your computer can’t run Kubernetes or can’t afford it, reach out to me and I will see what I can do.

Have fun studying, and remember there is a wonderful community out there to help you!

43 of 45

Important Links - https://github.com/bradmccoydev/cncf-community-manly

43

https://community.cncf.io/manly

https://kubernetes.io/docs/contribute/participate

slack.cncf.io

slack.k8s.io

https://www.cncf.io/certification/ckad

https://events.linuxfoundation.org/kubecon-cloudnativecon-europe/register

vim.rtorr.com

https://itnext.io/kubernetes-journey-cka-ckad-exam-tips-ff73e4672833

https://kubernetes.io/docs/home

Links will be added to: https://github.com/bradmccoydev/cncf-community-manly

44 of 45

Thank You

44

45 of 45

CC-BY License

45

https://community.cncf.io/manly

This presentation is licensed under a Creative Commons Attribution 4.0 International License.

See https://creativecommons.org/licenses/by/4.0/ for more details.