Tips for The Certified Kubernetes Exams: CKA and CKAD in 2020
Tags: kubernetes, devops, career, learning
Published: 2020-01-10 19:24:50

> **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](https://kubernetes.io/) for a while now. Thanks to Linux Academy, I've been able to get two Kubernetes certifications provided by the [Cloud Native Computing Foundation](https://www.cncf.io/):

- [Certified Kubernetes Administrator (CKA)](https://www.cncf.io/certification/cka/)
- [Certified Kubernetes Application Developer (CKAD)](https://www.cncf.io/certification/ckad/)

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](https://linuxacademy.com/cp/modules/view/id/281)
- Linux Academy Course: [Certified Kubernetes Administrator (CKA)](https://linuxacademy.com/cp/modules/view/id/327)
- Linux Academy Course: [Certified Kubernetes Application Developer (CKAD)](https://linuxacademy.com/cp/modules/view/id/305)

[**Will Boyd**](https://www.linkedin.com/in/wilb) and [**Chad Crowell**](https://twitter.com/ChadMCrowell) 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](https://training.linuxfoundation.org/go/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](https://training.linuxfoundation.org/wp-content/uploads/2020/04/Important-Tips-CKA-CKAD-April2020.pdf)
  - They also have a FAQ doc: [CKA and CKAD Frequently Asked Questions](https://training.linuxfoundation.org/wp-content/uploads/2020/04/CKA-CKAD-FAQ-April2020.pdf)

### 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.

###

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

```bash
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.

  ```bash
  # 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
  ```
  ```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 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

- Join the [Kubernetes Slack](https://slack.k8s.io/) workspace, and engage with the community
- [CKAD Exercises](https://github.com/dgkanatsios/CKAD-exercises)
- [Kubernetes Certified Administration](https://github.com/walidshaari/Kubernetes-Certified-Administrator): Excellent resource collection on GitHub
- [Kubernetes The Hard Way](https://github.com/kelseyhightower/kubernetes-the-hard-way)
- [kubectl Cheat Sheet](https://kubernetes.io/docs/reference/kubectl/cheatsheet/)
- Logz.io did a great blog article: [A Master List of Resources for Learning Kubernetes](https://logz.io/blog/resources-learn-kubernetes/)
- [CKA/CKAD Simulator - killer.sh](https://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

{% link https://dev.to/wingkwong/kubernetes-application-bible-for-developers-16p4 %}

{% link https://dev.to/boncheff/ckad-revision-core-concepts-o7l %}

## 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](https://icanteven.io/blog/cka-ckad-tips/) on January 10th, 2020_