CKA Mock exam question 3

Find the node across all clusters that consumes the most memory and store the result to the file /opt/high_memory_node in the following format cluster_name,node_name.

Troubleshooting: I ran below command on all the clusters(changed context depending on cluster)
kubectl top node --context cluster1 --sort-by memory | head 2
and saved the result in the given file using echo.

But its showing my answer is incorrect. Is this command wrong?

HI @uzmashafi061,

Please provide us the link to the labs

Regard

Lab- CKA Mock Exam 2 - KodeKloud

Hi @uzmashafi061,

The correct syntax is :

kubectl top node --context cluster1 --sort-by memory --no-headers | head -1

or

kubectl top node --context cluster1 --no-headers | sort -nr -k4 | head -1

Another point you have to compare node on all cluster it means you need to run the command for all clusters and compare manually which one consumes more memory.

The following command can help you get the list of cluster

k config view -o jsonpath='{.contexts[*].context.cluster}'

and this one the position of memory

kubectl top node --context cluster1 --sort-by memory 

Regard