Preparing for CKA and CKAD

Table of Contents

Some study tips you may not have found elsewhere for the Kubernetes CKA and CKAD exams

1 Which exam is harder? BOTH!

1.1 what's easier about CKAD

  • fewer challenges: 19 in 2 hours
  • mostly sticks to kubectl land
  • super relevant to SE work!

1.2 what's harder about CKAD

  • less time per challenge (19 / 120 minutes == ~6 minutes per)

1.3 what's easier about CKA

  • More time per challenge (8+ minutes per)
    • One hour extra time, but only 5 additional challenges (24 in 3 hours)

1.4 what's harder about CKA

  • Gotta know sysadmin for K8s and Etcd
    • Have your etcdctl, systemd, openssl basics down pat

2 Study resources

2.0.2 CKAD

2.0.3 Kubernetes the Hard Way

  1. What it will teach you for CKA
    • etcd
    • certificate generation
    • order of bootstrapping nodes
  2. What it will not teach you
    • Using kubeadm (used in the exams and in Konvoy)
    • examining and fixing certificates
    • lots of other stuff
      • The certificate generation was not useful in the exams - instead, you will need openssl to examine certificates and either openssl or kubeadm to refresh

2.0.4 Killer.sh - CKA and CKAD test simulators! (pay)   

3 Resources that may be used during the exam

During the exam, only one non-tty tab can be open, and only the kubernetes.io or the kubernetes repo on github may be visited

4 Hip tips for both tests

4.0.1 Practice a lot with Gate One

This is the browser based shell that is used for the exams.

This is supposedly available to test at http://liftoffsoftware.com/Products/GateOne, but I have had zero success with the site. This mirrors the experience of many people on the intertubes.

Fortunately, I found a working container for this.

On Docker:

docker run  --name=gateone -p 443:8000 -d yovio/gateone 

On K8s:

kubectl run gateone --image=yovio/gateone --restart=Never --port=443
kubectl expose pod gateone --port=8000 --target-port=443

Use Cloud load balancer or `kubectl port-forward` to access

4.0.2 Be fast with vim

  • Move/change/delete by word
  • Repeat command
  • Global search/replace
  • Multiline select and indent

4.0.3 Practice setup of alias and vim settings

  1. vim settings in ~/.vimrc
    set expandtab
    set tabstop=2
    set shiftwidth=2
    
  2. Alias and auto-completion
    • Test that Bash completion is working with kubectl:

      kubectl conf<TAB>
      # should expand to kubectl config
      
    • Set your aliases in ~/.bashrc

      alias k='kubectl'
      alias k='kubectl config set-context --current --namespace '
      alias kx='kubectl config get-contexts'
      

4.0.4 Get awesome with imperative kubectl

Avoid editing YAML from scratch at all costs. The `kubectl run` command is being deprecated, but is availabe as of 1.16.x - so use it!

# Create a pod
k run mypod --image=nginx --restart=Never --labels=app=mypod
# Create a Deployment - this is the default, so --restart may be omitted
k run mydeployment --image=nginx --restart=Always --replicas=3
# Create a Job
k run myjob --image=nginx --restart=OnFailure
# Create a Service
k expose deploy mydeployment --port=8080 --target-port=80 --type=NodePort --name myservice
# Create a DaemonSet by creating manifest for Deployment, then editing
  • Never create a service with YAML - use k expose
  • Test a service with k get ep

4.0.5 Learn some little about JSONPATH and –sort-by

Remember -o wide k get <manythings> and -o name for k get <anything>

4.0.6 Just prior to the exam

  1. Assign C-w to an extension

    This is to prevent accidentally closing the exam window! chrome://extensions -> Keyboard shortcuts

    I use the Quick Tabs extension

  2. Install/Enable the exam extension
  3. Disable all extensions other than the exam and the extension you assigned to C-w

4.0.7 Approach when first logged in

  1. Step 1: Assure vim settings are correct in ~/.vimrc
    set tabstop=2
    set expandtab
    set shiftwidth=2
    
  2. Step 2: suss environment
    w
    cat /etc/os-release
    
  3. Step 3: install bash-completion and tmux

    On CentOS/Red Hat

    sudo yum install bash-completion tmux
    source ~/.bashrc
    

    On Debian/Ubuntu

    sudo apt install bash-completion
    source /etc/bash_completion
    
  4. Step 4: aliases and completion
    alias k='kubectl'
    alias kn='kubectl config set-context --current --namespace '
    alias kx='kubectl config get-contexts'
    ## notes file: add, edit, notes (view)
    alias a='echo >> ~/.notes.txt '
    ## save my kubectl explain thangs in fast text files
    source <(kubectl completion bash)
    complete -F __start_kubectl k
    

Date: 2020-04-15T12:23:28-0600

Author: Gregory Grubbs

Created: 2020-08-06 Thu 07:35

Validate