Tips and Tricks

Before the Exam

Important Instructions

CKS Homepage CKS Homepage

System Compatibility Check

All information is on this page of the Linux Foundation site, to be done a few days before the exam.

Simulators:

Documentation Access

For CKA and CKAD exams, you are allowed to use certain websites and documentation to search for terminology and find answers to your questions. Here are the authorized sites:

Developing good knowledge of these documents can help you gain agility and speed during the exam. Additionally, these documents will help you develop a solid foundation in Kubernetes. Use these sites only to search for concepts and tools, and prepare your answers. Also learn to use the search functions effectively throughout the K8s documentation and bookmark all relevant and useful pages.

On Exam Day

The commands described here will certainly be useful:

Contexts

It is recommended to use kubectx in production but this tool is not available during the exam. Here are the main context management commands to know:

# List contexts
kubectl config get-contexts
# Switch context
kubectl config use-context <context-name>
# Modify current context, here to work in namespace <my-namespace>
kubectl config set-context  --current --namespace <my-namespace>

Pre-configuration

Once you have access to your terminal, it may be wise to spend about 1 minute configuring your environment. You can set these elements:

alias k=kubectl # will already be pre-configured

export do="--dry-run=client -o yaml"
# k get pod x $do

export now="--force --grace-period 0"
# k delete pod x $now

CKS: editing a control plane manifest

The API server, scheduler, controller manager and etcd are static pods: the kubelet of the control plane node runs the manifests of /etc/kubernetes/manifests. Many CKS tasks edit them (audit logs, encryption at rest, admission plugins, CIS remediations).

Warning

Very important: save a copy of the manifest outside /etc/kubernetes/manifests, e.g. in /root. The kubelet runs every file of this directory as a static pod: a backup copy there would start a second API server.

# On the control plane node (ssh)
cp /etc/kubernetes/manifests/kube-apiserver.yaml /root/kube-apiserver.yaml.orig
vi /etc/kubernetes/manifests/kube-apiserver.yaml
# The kubelet re-creates the pod: wait until the API server answers again
watch crictl ps
# If it does not come back
crictl ps -a | grep kube-apiserver
crictl logs <container-id>
ls /var/log/pods/ | grep kube-apiserver

Read the flags of a component without connecting to the node: kubectl describe pod -n kube-system kube-apiserver-<node>.

Vim

For vim to use 2 spaces for a tab, edit ~/.vimrc to add:

set tabstop=2
set expandtab
set shiftwidth=2