Micro-Blog 2 of 3 – Read These Before You Take the CKA: Hack. Time.

Microblog #2: HACK. TIME.

Welcome back to the micro-series on preparing for the CKA exam. This series is going to equip you with several tips and tricks that will help you navigate the exam and its common pitfalls so you save time and get to answering questions.

Let’s kick off this second round by focusing on what we ought to do after we clear the exam space requirements with the proctor:

HACK. TIME.

Well, no. Not really. But we are going to have a six-step process that will immediately save us time over the course of the exam.

The first thing we’ll do is navigate to the cheatsheet provided in the kubernetes.io documentation. It has some commands we can copy-paste straight into the terminal to gain an advantage. Specifically, these four:

source <(kubectl completion bash) 
echo "source <(kubectl completion bash)" >> ~/.bashrc 
alias k=kubectl
complete -F __start_kubectl k

There are two more not listed above that will speed up yaml creation if we need to create a resource from scratch:

Echo ‘alias kdr=”kubectl --dry-run=client -o yaml”’ >>~/.bashrc
Echo ‘complete -F __start_kubectl kdr’ >>~/.bashrc

Let’s break these commands down:

The first enables auto-completion provided for Kubernetes in the current shell. And the second adds it to the bash profile for perpetuity in case you need to resource your shell.

The third sets up an alias for kubectl to be invoked as k.  And the fourth makes sure that autocompletion is enabled for that alias. Those four alone are great, and will work wonders for your imperative commands.

The fifth and sixth are two little flavors I use and enjoy in my Kubernetes environments. For example, the fifth adds the alias of kdr to be kubectl --dry-run=client -o yaml and puts it in the bash profile. So you can create any resource that has dry-runs supported with three letters. And the sixth ensures that if we start with kdr, we can autocomplete.

I typically source the profile, to be extra-sure everything is set up correctly before getting started:

Source ~/.bashrc

That’ll do it for this microblog. Our next microblog will focus on the hands-on practicality that the CKA is well-known for, and how we can get that practicality.

Jonathan Lewey

Written by

Jonathan Lewey

Jonathan Lewey is a DevOps Content Creator at Cloud Academy. With experience in the Networking and Operations of the traditional Information Technology industry, he has also lead the creation of applications for corporate integrations and served as a Cloud Engineer supporting developer teams.


Related Posts

Jonathan Lewey
Jonathan Lewey
— April 6, 2021

Micro-Blog 3 of 3 – Read These Before You Take the CKA: The Cloud Is Just Someone Else’s Computer

Microblog #3: The Cloud Is Just Someone Else's Computer Welcome back! This tip is more of a strong recommendation than anything else.  Since the CKA and CKAD focus so strongly on your ability to prove that you can administer, or develop in a cluster, I wanted to take the time...

Read more
  • CKA
  • tips
Jonathan Lewey
Jonathan Lewey
— March 24, 2021

Micro-Blog 1 of 3 – Read These Before You Take the CKA: Becoming the Bookworm

Microblog #1: Become the Bookworm I know what you’re thinking, read a Kubernetes book blah blah blah. Actually no, but you will be reading something. This tip is all about breaking down the exam’s content to a molecular level and bookmarking the documentation that pertains to that co...

Read more
  • CKA