Certified Kubernetes Administrator (CKA) — Tips and Tricks — Part 2
Today let’s see about the static pod. There is a good weight for static pods and there is a high chance of it being a part of your exam. I did not get it correct on the first go and hence writing this blog.
Challenge 1: Recognizing the Question
The first challenge is to recognize the question as a static pod question. There may not be an explicit mention of the static pod, you will be asked to create a pod in a specific node by placing the pod definition file in a particular folder “/etc/kubernetes/manifests”. This is the folder where generally static pod definitions are kept. With these hints, you should recognize the question is all about static pods.
Challenge 2: Getting your YMAL Generator working
If you SSH into the node and tried using YAML generator as below
kubectl run — generator=run-pod/v1 nginx — image=nginx -o yaml — dry-run > nginx.yaml
It will not work as we are within a cluster on a specific node, kubeconfig on the specific node can’t connect to the cluster. The trick is to generate YAML before we SSH to the specific node, then copy the YAML into the exam notepad to use it after SSH.
Challenge 3: Make the node pick up the YAML
Once we keep the YAML definition into the folder “/etc/kubernetes/manifests” I expected it to work automatically, it did not work. The reason is static pod configuration is not done on the specific node kubelet by default. To make the static pod working, kubelet configuration file should have “staticPodPath”. Following steps will help to get the static pod up and running
- SSH to the node: “ssh my-node1”
- Gain admin privileges to the node: “sudo -i”
- Move to the manifest-path “cd /etc/kubernetes/manifests”
- Place the generated YAML into the folder “vi nginx.yaml”
- Find the kubelet config file path “ps -aux | grep kubelet” . This will output information on kubelet process. Locate the kubelet config file location as highlighted below
6. Edit the config file “vi /var/lib/kubelet/config.yaml” to add staticPodPath as highlighted below
7. Finally, restart the kubelet “systemctl restart kubelet”
You are all done. The static pod will be running on the specific node.
Also, visit other tips and tricks for Certified Kubernetes Administrator (CKA)
Certified Kubernetes Administrator (CKA) — Tips and Tricks — Part 1
Certified Kubernetes Administrator is a challenging exam by CNCF. Unlike many other certifications, it’s a practical…
Certified Kubernetes Administrator (CKA) — Tips and Tricks — Part 3
Today let’s look into ETDC backup. If you get this question it’s a jackpot. You can score the full mark in less than a…
Certified Kubernetes Administrator (CKA) — Tips and Tricks — Part 4
Mastering “Field Selectors”, “Custom Column” and “Sort By” will help us in a few questions at the CKA exam. In this…
Certified Kubernetes Administrator (CKA) — Tips and Tricks — Part 5
Init Container is the way to do some setup task before the actual container starts 🏄♀
Certified Kubernetes Administrator (CKA) — Tips and Tricks — Part 6
How to store sensitive information into the cluster with kubernetes secrets ㊙️
We will look into other tips and tricks in an upcoming article. Let you pass with flying colors :)