Preparation and materials for CKAD exam. @AlohaYo
- Resources: some online links
- kubernetes: quick guide by kube-resource name
- K8s catalog: catagorized document.
Just import the bookmarks, type the resource name will help you quickly guide to the page.
Offical doc explains the concepts of resources, but it's not what you need in exam. (If you need them in exam, you are really poor prepared.)
What's really useful is the sampl YAML files for some resources. They are useful. Just find and copy them to your exam will make you easy to pass.
-
PV/PVC/Pod use PV
-
Network Policy
-
etc
alias k=kubectl # will already be pre-configured
export do="--dry-run=client -o yaml" # k create deploy nginx --image=nginx $do
export now="--grace-period=0 --force" # k delete pod <pod_name> $now
-
Check your vim config file
~/.vimrc
: Add the configs if not to alignment works (exam environment should contain this):set nu set ts=2 set expandtab set shiftwidth=2 set autoindent
-
Useful Vim command:
dG
- Deletes contents from cursor to end of file. This is very useful when editing YAML files.ZZ
- Save and exit quickly.<n> yy
- Copy n lines from the current line<n> dd
- Cut n lines from the current linep
- Paste after this lineP
- Paster before this line:m,n>
Add one indent line m to n. Use multiple>
s for multiple indents.
- Network Policy Network Policy Editor for Kubernetes
-
Purchase exam
-
Couse is not necessary. Or I'll say, it's good, but emmm, not helpful.
-
In 2022, our company's exchange rate is around 7.0.
If the USD/RMB rate is under 7.0, you can purchase in USD with your Visa/Mastercard.
Otherwise, purchase it on Chinese site with RMB. 🤣
-
-
Take courses Take at least one of the options below as your course should all be good enough:
b. Enroll the KodeKloud course (free trial in 7 days or purchase)
c. Take the course on Udemy (Same teacher with KodeKloud. Cheaper than paid KodeKloud?)
d. Just read k8s.io/docs. Definitely enough if you read all!
-
Practice important
CKAD bundled course has no environment. 😥
You need to setup your own environment on:
- GCP/AWS environment: see the course material
- VRA: confluence page
KodeKloud/Udemy course does. That's helpful. RECOMMENDED
PS: Please get used to type
k
instead ofkubectl
during practice. It helps your exam. Absolutely! -
Review
- Quick browse through the Github repo CKAD exercises to check if you missed some points.
- Mark down all the official pages with useful YAML sample. (Remember the keyword to search them out)
- Take more courses if you have enough time.
- Challenge yourself: https://kodekloud.com/courses/kubernetes-challenges/
-
Simulate
Your CKAD exam (use your Linux Foundation) gives you 2 chances to simulate on Kill Shell. Each chance contains:
- 2-hour test
- 24-hour environment for reviewing your test results and answers
TIPS: a. The simulator is HELPFUL. Take it.
b. The simulator is hard. It's difficult to finish it in 2-hour first time. Just take it easy and try your best.
c. Review and understand each problem and answers after you finish it. No matter how long you take.
d. The second chance is the same question with the first.
You can reserve it the day before you take the real test. And try to finish it as fast as possible.
(Just practice your speed.)
Once you learned the course and finished the courses, the exam is not hard. I mean it's definitely different to conquer all problems but your goal is passing the exam (66% is good). That's easy with your preparation and "Time Management" and Give Up
-
Open terminal, test
kubectl
and setup shell alias immediately. -
Open the browser in Linux remote desktop (not web terminal anymore), navigate to k8s.io/docs. Put your browser and terminal easy to switch.
-
Now begin your problems
-
Read the task, if the task is really long, or it contains some resources you are not familiar (e.g. CRD), just mark it and skip it.
-
For the task you do not skip, copy the
kubectl config use-context xxx
command and run it immediately.It's important to switch context for each question.
-
Also remember the namespace.
Always run
k -n <namespace> <command>
when you practice. -
Each question has a "task weight", and it actually has sub-tasks. Don't forget the easy sub-tasks. They are your values!
(e.g. copy your yaml file after you create resources)
-
Always use
k
instead ofkubectl
. It saves a lot of time. A 7-character word could be hit typo a lot of times. 🫢- For creating a pod, use
k run
. - For creating a simple resource like configmap, secret, use
k create configmap question-10 --from-literal=foo=bar
- For creating complicated resources, create YAML file first, then
k apply -f xxx.yaml
ork create -f xxx.yaml
- To create yaml, use the dry-run alias if create yaml template (pod, deployment, etc):
kubectl create deployment --image=nginx question-12 $do
- Or copy the yaml template from k8s docs, e.g. pv, pvc, netpol, ingress, egress, etc.
- Make good use of VIM shortcuts.
e.g. Turn a job's yaml to a cronjob, use
:m,n>
to indent the job'stemplate
tojobTemplate
:apiVersion: batch/v1 kind: Job metadata: name: hello spec: template: spec: containers: - name: hello image: busybox:1.28 imagePullPolicy: IfNotPresent command: - /bin/sh - -c - date; echo Hello from the Kubernetes cluster restartPolicy: OnFailure
- Type
:5,15>>
in command mode. - Insert the cronjob definitions in the line 5:
spec: schedule: "* * * * *" jobTemplate:
apiVersion: batch/v1 kind: CronJob metadata: name: world spec: schedule: "* * * * *" jobTemplate: spec: template: spec: containers: - name: hello image: busybox:1.28 imagePullPolicy: IfNotPresent command: - /bin/sh - -c - date; echo Hello from the Kubernetes cluster restartPolicy: OnFailure
- Type
- Use VIM command to modify the YAML from sample or dry-run:
e.g. Create a network policy with 2 egress rules:
Find the NetworkPolicy sample on k8s doc:
apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: test-network-policy namespace: default spec: podSelector: matchLabels: role: db policyTypes: - Ingress - Egress ingress: - from: - ipBlock: cidr: 172.17.0.0/16 except: - 172.17.1.0/24 - namespaceSelector: matchLabels: project: myproject - podSelector: matchLabels: role: frontend ports: - protocol: TCP port: 6379 egress: - to: - ipBlock: cidr: 10.0.0.0/24 ports: - protocol: TCP port: 5978
- Cut the ingress section off by moving cursor to
ingress
line. - Type command
15dd
directly. - Move cursor to
to:
line to copy the egress. - Type command
6yy
. - Move the the end line, type
p
. - Finally modify
ipBlock
andport
. You got this:
apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: test-network-policy namespace: default spec: podSelector: matchLabels: role: db policyTypes: - Ingress - Egress egress: - to: - ipBlock: cidr: 10.0.0.0/24 ports: - protocol: TCP port: 5978 - to: - ipBlock: cidr: 192.168.0.0/16 ports: - protocol: TCP port: 8080
- Cut the ingress section off by moving cursor to
- For creating a pod, use