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