Tips for The Certified Kubernetes Exams: CKA and CKAD

How Linux Academy prepared me, and what exam tips ultimately helped me get both certifications

Derek Ardolf

6 minute read

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:

  • 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.17

  • 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.17.x

  • 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 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 run nginx-deploy --image=nginx --env="CONFIGPATH=/etc/myconfig" --port=80 --replicas=3 --dry-run -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: {}
  • 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.

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!


This article can also be viewed on dev.to

comments powered by Disqus