Jim Sander (IO)

Semi-Static Site for jimsander.io

View on GitHub
About Main
11 July 2022

Quick Prep for CKA Exam

by Jim

CKA Cert Having only the most basic high-level hands-on experience with k8s in the past, I thought why not immerse myself a little to prep for the CKA Exam.

First, I deployed a small cluster (1c 2n) on my home network, then took a couple of A Cloud Guru Courses, went through their non-industry certificate of completion, and finally, went through KelseyHightower’s Deploying Kubernetes the Hard Way, a bit dated but all relevant.

Afterwards, I thought I was about ready to begin my first pass at the test. I say first because, they give you one free re-take, and I was pretty sure I’d flub the initial, which I did. The failure wasn’t soley on knowledge of the material, rather, the online exam method they use is a virtual “keyhole”; it’s a remote linux desktop.

Tips for efficiency

Linux Desktop “Navigation”

Now, I’m a Linux fan, but not a Linux desktop fan, and avoid using the GUI if I can help it. However, the CKA PSI Bridge (as they call it) allows only 2 apps:

  1. Terminal
  2. Firefox

The questions are posed in the left of the “portal” where they give you a k8s config use <cluster_name> for each question, and to ensure you don’t typo anything, copy and paste the strings into the terminal.

Not so bad, but I was used to using my macbook for command-C or V and Command-F for most cut-and-paste. In the Linux desktop it’s slighly different

  1. terminal :
    • shift+control+C or V
  2. firefox:
    • control-F to search page
    • control-C to copy text

Although it’s NOT a big deal, it was enough to fluster me to where it chewed up a good bit of my 2 hour window.

Shortcuts/Aliases

Obviously, time is of the essence here. So, when you first start, get your aliases established:

File: .kuberc

When seconds count on the exam, TAKE A MINUTE or two to get this in your .bash_profile or wherever.

source <(kubectl completion bash)
alias k=kubectl

complete -o default -F __start_kubectl k
export dry="--dry-run=client -o yaml"
alias kns="k config set-context --current --namespace "
alias kgns="k config view --minify -o jsonpath '{..namespace}'; echo"
alias kcd="k create $dry"
alias kcr="k create "
alias kgp="k get po"
alias kgn="k get nodes"
alias kgall="k get nodes,po,svc,ep -o wide"

“Template” the spec files

My first pass, I was hunting and pecking in the k8s documention for examples of YAML specs for the various questions, and this was a HUGE waste of time. The better way is to use kubectl create --dry-run=client .. and modify the output

For example, one question involved creating a replicaset. Now, there’s no way to create a replicaset from just command line, so create a deployment, and modify the template.

kcd deployment foo --image nginx | tee rs_foo.yml
# change 'kind' to ReplicaSet
# remove 'strategy'
kcd -f rs_foo.yml

There’s a couple of other tips, but can’t think of them at the moment, will add them as I recall.

Related Certificates

Hot damned! Time well spent

tags: cka - certification - kubernetes - k8s - training