Subrata Biswas:
Hi Guys, I have a question about the question in Mock test 3 in the screenshot , where it asks for node internal ip in the format “InternalIP of Of ControlPlane <space> InternalIP Of Node01” I have used -o=jsonpath='{range items[*]}{@.status.addresses[?(@.type==“InternalIP”)].address}{" "}{end} ’ > location of file and also I tried with manually adding ip to file with space as asked. But it marks as wrong answer where in the solution jsonpath this is is slightly different which is without range. Then only difference is there is no carriage return at the end . If I manually delete carriage return by using file | tr -d “\n” , the answered is marked correct. I am just wondering if the answer will be considered wrong just for one carriage return at the end where actual answer is correct which contains correct ip with right format
unnivkn:
controlplane $ kubectl get nodes -o jsonpath=‘{.items[*].status.addresses[?(@.type==“InternalIP”)].address}’
172.17.0.8 172.17.0.53controlplane $
controlplane $
unnivkn:
copy & paste the ip in your file
unnivkn:
you can get this from cheat sheet:
unnivkn:
# Get ExternalIPs of all nodes
kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}'
unnivkn:
just change External to Internal
Subrata Biswas:
I did but my question is I have generated the same output using {rang .items[*]}{end}
Subrata Biswas:
why is this being marked wrong as only difference is carriage return (“\n”) and EOF beofore that and node ips and format are right
unnivkn:
carriage return won’t allow… while validating the answer
Subrata Biswas:
but how will I understand only EOF/Carriage return will make difference in the exam for example if I am asked to list just pod name one at a time I can either do k get po -o NAME or k get po -o=jsonpath=‘{range .items[*]}{@.metadata.name}{end}’ or I can do k get po | awk ‘{print $1 }’ , how do I know which will be correct only different first will provide with pod in format pod/podname
Ps:
I also have the same question. Following.
Any sane command output typically contains new line char at the end. So “hoping” the validation in the practice test environment is not not proper for this question.