Question
List name of all nodes as per below format and save the output in /tmp/node-names.txt file. The format should be:
NODE_NAME
node01
node02
Answerkubectl get nodes -o=custom-columns=NODE_NAME:.metadata.name
kubectl get nodes -o=custom-columns=NODE_NAME:.metadata.name > /tmp/node-names.txt
If you don’t need to include custom columns in the result - then jsonpath can be used