Certified Kubernetes Administrator
(CKA)
[student@node-1]$ kubectl config use-context-mk8s
Task:
Given an existing Kubernetes cluster running version 1.18.8, upgrade all of the Kubernetes
control plan and node components on the master node only to version 1.19.0.
You are also expected to upgrade kubelet and kubectl on the master node.
Be sure to drain the master node before upgrading it an uncordon it after the upgrade. Do
not upgrade the worker nodes, etcd, the container manager, the CNI plugin, the DNS service
or any other addons.
--------------------------------------------------------
A.)
kubectl drain <node-to-drain> --ignore-daemonsets
root@controlplane:~# apt update
apt-get update && \
apt-get install -y --allow-change-held-packages kubeadm=1.22.x-00
kubeadm version
kubeadm upgrade plan
kubeadm upgrade apply v1.20.0
apt-get update && \
apt-get install -y --allow-change-held-packages kubelet=1.22.x-00 kubectl=1.22.x-00
B.)
sudosystemctl daemon-reload
sudosystemctl restart kubelet
kubectluncordon<node-to-drain>
,C.
sudosystemctl system-reload
sudosystemctl uplooad-kubelet
kubectluncordon<note-to-drain>
B
Set configuration context:
[student@node-1]$ kubectl config use-context k8s
Task:
From the pod label name=cpu-user, find pods running high CPU workloads and write the
name of the pod consuming most CPU to the file /opt/KUTR00401/KUTR00401.txt (which
already exists).
--------------------------------------------------------
A.)
kubectl top -l name=cpu-utilizer –A echo 'pod name' >>/opt/KUT00401/KUT00401.txt
kubectl top pod --sort-by='cpu' --no-headers | head -1
or
kubectl top pods -l name=name-cpu-loader --sort-by=cpu
echo ‘top pod name' >>/opt/KUTR00401/KUTR00401.txt
or
kubectl top node --sort-by='cpu' --no-headers | head -1
kubectl top pod --sort-by='memory' --no-headers | head -1
kubectl top pod --sort-by='cpu' --no-headers | tail -1
B.)
kubectl top note-l name=name-cpu-loader --sort-by=cpu
, echo ‘top note name' >>/opt/KUTR00401/KUTR00401.txt
C.)
kubectl top node --sort-by='cpu' --no-footer| head -1
A
Previous
Play
Next
Rewind 10 seconds
Move forward 10 seconds
Unmute
0:00
/
0:15
Full screen
Brainpower
Read More
Set configuration context:
[student@node-1]$ kubectl config use-context k8s
Task:
Check to see how many nodes are ready (not including nodes tainted NoSchedule) and
write the number to /opt/KUSC00402/kusc00402.txt
--------------------------------------------------------
A.)
kubectl get nodes
kubectl get node | grep -i ready |wc -l
kubectl describe nodes | grep ready|wc -l
kubectl describe nodes | grep -i taint | grep -inoschedule | wc -l
echo 3 > /opt/KUSC00402/kusc00402.txt
JSONPATH='{range .items[*]}{@.metadata.name}:{range
@.status.conditions[*]}{@.type}={@.status};{end}{end}'\
(CKA)
[student@node-1]$ kubectl config use-context-mk8s
Task:
Given an existing Kubernetes cluster running version 1.18.8, upgrade all of the Kubernetes
control plan and node components on the master node only to version 1.19.0.
You are also expected to upgrade kubelet and kubectl on the master node.
Be sure to drain the master node before upgrading it an uncordon it after the upgrade. Do
not upgrade the worker nodes, etcd, the container manager, the CNI plugin, the DNS service
or any other addons.
--------------------------------------------------------
A.)
kubectl drain <node-to-drain> --ignore-daemonsets
root@controlplane:~# apt update
apt-get update && \
apt-get install -y --allow-change-held-packages kubeadm=1.22.x-00
kubeadm version
kubeadm upgrade plan
kubeadm upgrade apply v1.20.0
apt-get update && \
apt-get install -y --allow-change-held-packages kubelet=1.22.x-00 kubectl=1.22.x-00
B.)
sudosystemctl daemon-reload
sudosystemctl restart kubelet
kubectluncordon<node-to-drain>
,C.
sudosystemctl system-reload
sudosystemctl uplooad-kubelet
kubectluncordon<note-to-drain>
B
Set configuration context:
[student@node-1]$ kubectl config use-context k8s
Task:
From the pod label name=cpu-user, find pods running high CPU workloads and write the
name of the pod consuming most CPU to the file /opt/KUTR00401/KUTR00401.txt (which
already exists).
--------------------------------------------------------
A.)
kubectl top -l name=cpu-utilizer –A echo 'pod name' >>/opt/KUT00401/KUT00401.txt
kubectl top pod --sort-by='cpu' --no-headers | head -1
or
kubectl top pods -l name=name-cpu-loader --sort-by=cpu
echo ‘top pod name' >>/opt/KUTR00401/KUTR00401.txt
or
kubectl top node --sort-by='cpu' --no-headers | head -1
kubectl top pod --sort-by='memory' --no-headers | head -1
kubectl top pod --sort-by='cpu' --no-headers | tail -1
B.)
kubectl top note-l name=name-cpu-loader --sort-by=cpu
, echo ‘top note name' >>/opt/KUTR00401/KUTR00401.txt
C.)
kubectl top node --sort-by='cpu' --no-footer| head -1
A
Previous
Play
Next
Rewind 10 seconds
Move forward 10 seconds
Unmute
0:00
/
0:15
Full screen
Brainpower
Read More
Set configuration context:
[student@node-1]$ kubectl config use-context k8s
Task:
Check to see how many nodes are ready (not including nodes tainted NoSchedule) and
write the number to /opt/KUSC00402/kusc00402.txt
--------------------------------------------------------
A.)
kubectl get nodes
kubectl get node | grep -i ready |wc -l
kubectl describe nodes | grep ready|wc -l
kubectl describe nodes | grep -i taint | grep -inoschedule | wc -l
echo 3 > /opt/KUSC00402/kusc00402.txt
JSONPATH='{range .items[*]}{@.metadata.name}:{range
@.status.conditions[*]}{@.type}={@.status};{end}{end}'\