I have a query related to this task
please set the context to cluster1
by running:
kubectl config use-context cluster1
There is a script located at /root/pod-cka26-arch.sh
on the student-node
. Update this script to add a command to filter/display the label with value component
of the pod called kube-apiserver-cluster1-controlplane
(on cluster1
) using jsonpath
The answer given was
kubectl --context cluster1 get pod -n kube-system kube-apiserver-cluster1-controlplane -o jsonpath=‘{.metadata.labels.component}’
My question is do, since we are already setting the context to cluster1 as part of the question, do we need to mention again the context in the kubectl command as part of label value extraction ? when i gave this one alone, the answer was showing wrong.
kubectl get pod -n kube-system kube-apiserver-cluster1-controlplane -o jsonpath=‘{.metadata.labels.component}’