CKAD Exam Preparation 1/4 - Cross Cutting Aspects
This part covers cross-cutting aspects to be known in order to pass the CKAD Certification Exam. To learn more about the CKAD exam please read this overview.
About this Series
During this blog series I summarize the main “study hooks” in order to be successful with your exam, as I was. The series is composed by the following articles:
- Part 1. Cross-Cutting Aspects
- Part 2. Pods and Jobs.
- Part 3. Configuration and Volumes.
- Part 4. Deployments, Services and Networking.
All the examples have been developed using minikube on macOS Catalina with VirtualBox.
🧭 Environment Setup
During the exam you will be allowed to open only one browser tab pointing to the K8s documentation Web site.
The main links to remember are below, namely the concepts one, as it will allow you to copy and paste certain
object manifests easily, for instance
- 📖 Documentation home page: https://kubernetes.io/docs/home/
- 📖 K8s concepts: https://kubernetes.io/docs/concepts/
- 📖 K8s reference: https://kubernetes.io/docs/reference/
kubectlcheat sheet https://kubernetes.io/docs/reference/kubectl/cheatsheet/
kubectl is ready to enable autocomplete and that can save you precious time. I found kubectl autocomplete enabled during my exam but in any case you can find how to enable it in the cheat sheet.
To remember the syntax and structure of YAML object manifests
kubectl explain will be your best ally.
Just using the syntax
<object_name>.<property> you can get the corresponding documentation without going
to documentation web pages. Remember that any K8s object has four main fields:
spec and the meaty part is at
At any time you can get detailed kubectl command syntax. The nice thing about
that it is available at any nesting level, for instance:
If you are going to use
nano as editor you must configure it properly in order to deal with YAML edition. Edit a file named
You may also need (actually I did not use it) to use a term multiplexing solution such as
tmux you can
- Ctrl + b + “ → Split horizontally and create a new horizontal pane
- Ctrl + b + cursor up / cursor down → Move between panes
- Ctrl + b + x → Kill pane
More information on how to use
tmux can be found at:
- 📓 http://www.sromero.org/wiki/linux/aplicaciones/tmux
- 📓 https://medium.com/@jeongwhanchoi/install-tmux-on-osx-and-basics-commands-for-beginners-be22520fd95e
Configuration and Namespaces
Your exam is going to be conducted (from a base node) in different K8s Clusters and Namespaces.
kubectl allows you to work against different Clusters provided you have set the proper Configuration Context.
To view your Configuration:
📌 Remember the structure of Configurations and Contexts:
If you want to set up a new Context with a particular User, Cluster and Namespace:
If your Context is not pointing to the Namespace you want to work with you can specify it:
To refer to all Cluster Namespaces:
📌 A Namespace can also be referenced at the
metadata level of an object manifest.
Create a new Namespace:
Defining a Resource Quota for a Namespace:
📌 Once a Namespace defines Resource Quotas, an object must
request its minimum resource requirements. If there are not sufficient available resources in the Namespace based on the
request an object may not run or may be killed.
dnsutils Pod can be used to check that DNS resolutions are working properly.
✂️ Generic Operations
Create an object:
Apply an object manifest:
📌 Some objects do not admit overriding certain fields.
Delete an object:
Edit an object:
Patch (update) an object using JSON/YAML Patch:
Patch example: Changing a Pod’s image:
📌 You need to provide a merge key. In the example above is
📌 With a strategic merge patch, a list is either replaced or merged depending on its patch strategy defined by the K8s API.
📌 With a JSON merge patch, if you want to update a list, you have to specify the entire new list. And the new list completely replaces the existing list.
Get detailed information about an object.
describe provides long descriptions:
get command does not display labels by default.
--show-labels will do the trick.
-w option allows to watch what is happening with a certain object.
Use JSON Path to filter fields of an object descriptor (manifest):
To re-label an object (
--overwrite has to be used if we are updating an existing label):
Remove labels from a set of objects (Appending a dash to the label name i.e.
-l is intended to select the concerned objects by matching labels.
Reference several objects, for instance annotate a set of Pods:
Display resource consumption of Pods:
📌 Application monitoring does not depend on a single monitoring solution.
metrics-server is a lightweight monitoring solution that can be easily enabled on minikube.
Display resource usage of each K8s Node:
More detailed information about a Node can be obtained by: