UPDATED 05/05/2020: Updated a handful of links based on the April 2020 changes to both exams, having moved to Kubernetes v1.18.x
UPDATED 02/03/2020: Updated a handful of links based on the January 2020 changes to both exams, having moved to Kubernetes v1.17.x
I've been wanting to learn Kubernetes for a while now. Thanks to Linux Academy, I've been able to get two Kubernetes certifications provided by the Cloud Native Computing Foundation:
Linux Academy is one of the few courseware websites that I use, and that's after using many different ones over the years. I really appreciate the content, and especially their Cloud Playground with hands-on labs. I highly recommend the courses on there for those certifications.
Both exams come with one free retake voucher in the event that a first attempt doesn't go as planned, so definitely take a look.
Here are the courses I took, in preparation:
- Linux Academy Course: Kubernetes Essentials
- Linux Academy Course: Certified Kubernetes Administrator (CKA)
- Linux Academy Course: Certified Kubernetes Application Developer (CKAD)
Will Boyd and Chad Crowell made excellent course content.
Exam Tips
Looking to take the exams yourself? They are interactive, task-based exams rather than Q&A. Other than my recommendations above about taking the Linux Academy courses, here is what helped me succeed:
Resources from The Cloud Native Foundation
The CKA / CKAD Candidate Handbook gives an overview of how the exam works, and what knowledge is expected. It also will include what version of Kubernetes will be used in the exam environment. From the current handbook:
The clusters comprising the exam environment are currently running Kubernetes 1.18
The Cloud Native Foundation also has their own Important Tips PDF that you may want to take a look at. Here is the version current with the exams I had taken: Exam Tips for CKA and CKAD, Kubernetes v1.18.x
- They also have a FAQ doc: CKA and CKAD Frequently Asked Questions
Official Kubernetes Documenation
Learn how to comfortably navigate the official documentation website of kubernetes.io/docs since you can use it during the exam. If you can do all the hands-on labs in the certification-prep courses, on your own without the solutions provided, then you're ready. Use the official docs first before resorting to the Linux Academy provided solutions!
Many examples within the https://kubernetes.io/docs/tasks/ section of the official docs include YAML template links. I used these to speed up completion of certain exam objectives by right-clicking -> "Copy link address" -> and pasting into my exam terminal with wget <yml-source-url>
-> then editing the templates from there. This helped for when I couldn't quite remember syntax for certain things, or if I just wanted a quick way to have a base template mapped out that I could just edit from there.
# CREATING PERSISTENT VOLUMES,
# AND PERSISTENT VOLUME CLAIMS,
# AND MOUNTING PVCS IN PODS
# Search the docs:
## https://kubernetes.io/docs/search/?q=persistent+volume
# Look for https://kubernetes.io/docs/tasks/ URLs
# From: https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/
# Persistent Volume YAML
wget https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/pods/storage/pv-volume.yaml
# Persistent Volume Claim YAML
wget https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/pods/storage/pv-claim.yaml
# Pod using Persistent Volume Claim YAML
wget https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/pods/storage/pv-pod.yaml
# pv-volume.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: task-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
# pv-claim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: task-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
# pv-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: task-pv-pod
spec:
volumes:
- name: task-pv-storage
persistentVolumeClaim:
claimName: task-pv-claim
containers:
- name: task-pv-container
image: nginx
ports:
- containerPort: 80
name: "http-server"
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: task-pv-storage
# Deploy them all
kubectl apply -f pv-volume.yaml
kubectl apply -f pv-claim.yaml
# Ensure pv-claim has status of 'Bound'
kubectl get pvc
# Create the pod
kubectl apply -f pv-pod.yaml
I used YAML configs for practically all questions where I could, and I named them starting with the question number for easy navigation throughout the exam. Example: something like naming 04-nginx-svc.yml
if question 4 was about exposing an nginx service. This also helps if you realize on a later question that you forgot a small detail, such as namespace missing from the YAML!
Since there are many tasks that use similar components (such as Deployments, Services, pv, pvc, etc.), it can be helpful to simply copy template files and edit from there:
cp 12-deployment.yaml 13-deployment.yaml # Copy
vim 13-deployment.yaml # Tweak
kubectl apply -f 13-deployment.yaml # Deploy
- Become familiar with the
kubectl expose
andkubectl create
commands for simplified template generation. Note thatkubectl run
commands may bark at you, as certain generators are gradually being deprecated, but they still currently work and can create templates.
# EXAMPLES
# ConfigMaps
kubectl create configmap poxy-cfg --from-file=config.txt
# CronJob: This runs once a minute, merely runs 'date'
kubectl create cronjob date-check --image=busybox --schedule='*/1 * * * *' -- date
# Tagging this to the end of
# kubectl create // kubectl expose // kubectl run
# commands can output a great template as a starting place
# <cmd> --dry-run -o yaml > template.yaml
# Deployment w/ kubectl run
# Works in k8s v1.16.x
# Deployment generator will be deprecated in the future
kubectl create deploy nginx-deploy --image=nginx --env="CONFIGPATH=/etc/myconfig" --port=80 --replicas=3 --dry-run=client -o yaml > nginx-deploy.yaml
# Deployment example; not deprecating
kubectl create deployment my-deployment --image=nginx --dry-run -o yaml > deployment-test.yaml
vim deployment-test.yaml
# Pod creation with kubectl run w/ lots of stuff
# NOT deprecating!
kubectl run nginx-pod --generator=run-pod/v1 --image=nginx --env="CONFIGPATH=/etc/myconfig" --port=80 --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi --dry-run -o yaml > nginx-pod.yaml
# See all kubectl run options
kubectl run
# Service example
kubectl expose deployment/my-deployment --target-port=80 --type NodePort --dry-run -o yaml > service-test.yaml
vim service-test.yaml
# nginx-pod.yaml created by kubectl run nginx-pod ... above
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx-pod
name: nginx-pod
spec:
containers:
- env:
- name: CONFIGPATH
value: /etc/myconfig
image: nginx
name: nginx-pod
ports:
- containerPort: 80
resources:
limits:
cpu: 200m
memory: 512Mi
requests:
cpu: 100m
memory: 256Mi
dnsPolicy: ClusterFirst
restartPolicy: Always
status: {}
- Have a lab environment where you can consistently create, modify, scale, and delete nodes, pods, deployments, services, etc. Setup the metrics server, too! Nothing beats continuous, hands-on experience when preparing for your exam(s). This was an added bonus with Linux Academy: they have lab environments that you can spin up and easily configure, at their direction, at no additional cost to your subscription. If you don't have a subscription, find a way to setup a lab environment that works best for you.
- Three hours for the CKA and two hours for CKAD may seem like long windows, but the time will fly by. I had to retake the CKA because the exam ended before I could get to the last several questions! That's a major loss of points by default. Thankfully, the free retake helped me pass it, along with these tips above. With the CKAD, I finished the last question with only two minutes to spare. Keep an eye on the time, and also skip a question if it seems like it will take a long time or if you are uncertain how to answer it. Keep track of which questions you have left unanswered in either the exam notepad or in a local file like
vim skipped.txt
that you can come back to later. - Use the
--all-namespaces
argument when troubleshooting problems, as it helps view all potentials regardless of namespace placement. Also, remember to use-n <namespace>
argument throughout the exam. For my own sanity, I always used the.metadata.namespace
attribute of my YAML templates so that I didn't have to remember to runkubectl apply -f template.yaml -n <namespace>
later on or remember if I had.
Additional Resources
I've seen other recommendations from the community that have helped others, and thought may be worthwhile to include in here.
Links
- Join the Kubernetes Slack workspace, and engage with the community
- CKAD Exercises
- Kubernetes Certified Administration: Excellent resource collection on GitHub
- Kubernetes The Hard Way
- kubectl Cheat Sheet
- Logz.io did a great blog article: A Master List of Resources for Learning Kubernetes
- CKA/CKAD Simulator - killer.sh: Though this is a paid service, I've heard from exam takers that this was an incredibly helpful exam prep.
Other DEV Articles
Article No Longer Available
CKAD - Revision - Core Concepts
boncheff ・ Jan 26 '20 ・ 3 min read
Discussion
Have any questions about the exam process? Or have you also taken the exam, and want to include some extra advice? Please contribute to the discussion below!
Originally published at https://icanteven.io on January 10th, 2020
Top comments (9)
Taking the test soon. One thing I would add is a simple bash tip. Something as simple as this could save a few seconds.
vim 13-deployment.yaml # Tweak
kubectl apply -f !$ # Deploy - using a bash expansion to place file name. Less typing, or tabbing.
Hey! Did you end up taking the exam? If so, how did it go and what things helped you the most?
Yes. Passed with a 92 I think. Everything runs together these days. I used the udemy course by kodecloud. I also setup a cluster and played with it everyday for a few months. In the end, the test wasn't bad. I think it's been made to seem more difficult than it was. The reality is that it's a test to show you have a baseline of knowledge on how to admin k8s. It's not some sort of CCIE for kubernetes.
You either know it or you don't. The docs helped, but I think using kubectl hands on was what helped the most.
Oh, and knowing vi is super helpful. It made editing yaml pretty easy. But I did have the advantage of using for nearly 20 years.
Very nice collection of questions for CKA preparation. I also created a dedicated course on Udemy for CKA exam and more than 1k+ people get benefited
My CKA Course
These are some great suggestions, I especially like the idea around numbering files for questions. I'll have to borrow that idea...
It certainly helped me. If you give either of the exams a go: good luck, and please report back on how things go!
NOTE: Article has been updated to reflect updated links related to January 2020 changes to both exams (which now uses Kubernetes v1.17.x)
NOTE: Article has been updated to reflect updated links related to April 2020 changes to both exams (which now uses Kubernetes v1.18.x)
Also, not sure when they will deprecate it, but I like to use --restart=Never when using kubectl run to create pods. That way I don't need to remember the generator syntax.