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?
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.