loading...
Cover image for Tips for The Certified Kubernetes Exams: CKA and CKAD in 2020

Tips for The Certified Kubernetes Exams: CKA and CKAD in 2020

scriptautomate profile image Derek Ardolf Originally published at icanteven.io Updated on ・7 min read

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:

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

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
Enter fullscreen mode Exit fullscreen mode
# 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"
Enter fullscreen mode Exit fullscreen mode
# pv-claim.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: task-pv-claim
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi
Enter fullscreen mode Exit fullscreen mode
# 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
Enter fullscreen mode Exit fullscreen mode
# 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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode
  • Become familiar with the kubectl expose and kubectl create commands for simplified template generation. Note that kubectl 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
Enter fullscreen mode Exit fullscreen mode
  # 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: {}
Enter fullscreen mode Exit fullscreen mode
  • 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 run kubectl 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

Other DEV Articles

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

Discussion

pic
Editor guide
Collapse
cocampbe profile image
Court

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.

Collapse
scriptautomate profile image
Derek Ardolf Author

Hey! Did you end up taking the exam? If so, how did it go and what things helped you the most?

Collapse
cocampbe profile image
Court

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.

Collapse
kenmoini profile image
Ken Moini

These are some great suggestions, I especially like the idea around numbering files for questions. I'll have to borrow that idea...

Collapse
scriptautomate profile image
Derek Ardolf Author

It certainly helped me. If you give either of the exams a go: good luck, and please report back on how things go!

Collapse
scriptautomate profile image
Derek Ardolf Author

NOTE: Article has been updated to reflect updated links related to April 2020 changes to both exams (which now uses Kubernetes v1.18.x)

Collapse
scriptautomate profile image
Derek Ardolf Author

NOTE: Article has been updated to reflect updated links related to January 2020 changes to both exams (which now uses Kubernetes v1.17.x)

Collapse
cocampbe profile image
Court

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.