Training

Final run of the week 1 series. For some reason the app tracked me at just over 1km, but fitbit tracked me at 4km. Probably quirky gps.

 

kubectl Displaying Taints

One of the questions in my CKA exam was how to display taints with kubectl. While you can use kubectl describe, it creates a lot of other information too.

Then I found out about jsonpath and it’s similarity to jq

You can display the taints with something like

for a in $(kubectl get nodes --no-headers | awk '{print $1}')
do
echo $a -- $(kubectl get nodes/$a -o jsonpath='{.spec.taints[*].key}{":"}{.spec.taints[*].effect}')
done

Sample output

ip-10-10-10-147.eu-west-2.compute.internal -- node-role.kubernetes.io/master:NoSchedule
ip-10-10-10-159.eu-west-2.compute.internal -- :

So the first one has a taint (it’s the master node) and the second one doesn’t.
(maybe I need to hack this a bit more when I have multiple taints but I’ll do that when I have some multi-tainted nodes to play with)

EDIT: Another way as provided by tdodds81

$ kubectl get nodes -o=custom-columns=NAME:.metadata.name,TAINTS:.spec.taints
NAME TAINTS
ip-10-10-10-148.eu-west-2.compute.internal [map[effect:NoSchedule key:node-role.kubernetes.io/master]]
ip-10-10-10-218.eu-west-2.compute.internal
ip-10-10-10-239.eu-west-2.compute.internal
ip-10-10-10-249.eu-west-2.compute.internal
ip-10-10-10-51.eu-west-2.compute.internal

And with multi-taints, it looks like this (on a GKE cluster)

$ kubectl get nodes -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taints
NAME                                                  TAINTS
gke-test-cluster-k8s-n1-highmem-2-nod-589548dd-3z1v   [map[effect:NoSchedule key:key1 timeAdded:<nil> value:value1] map[value:value2 effect:NoSchedule key:key2 timeAdded:<nil>]]
gke-test-cluster-k8s-n1-highmem-2-nod-7a33f13b-9lwk   <none>
gke-test-cluster-k8s-n1-highmem-2-nod-7a33f13b-lnvl   <none>
gke-test-cluster-k8s-n1-highmem-2-nod-7a33f13b-nt49   <none>
gke-test-cluster-k8s-n1-highmem-2-nod-7a33f13b-xgbd   <none>

CKA Exam

Well, exam is done — for the most part it went okay. A few questions were a bit ambiguous and there were several regarding etcd and low-level tinkering with the kubelet — which I hadn’t had too much experience with unfortunately.  I’m hoping I did OK, though…

CKAD

While booking my CKA exam earlier, I spotted that there was a second Kubernetes certification — Certified Kubernetes Application Developer.

While the CKA is for the admin of the cluster and tests the knowledge of the infrastructure, CKAD is more for the developers.

Looks like that’ll be my next certification…

CKA

With less than 24 hours to go before my exam, I’m going to spend those last hours going through the review questions and see if I can still remember the content.