Use official metrics server – https://github.com/kubernetes-sigs/metrics-server
If you use one master node, run this command to create the metrics-server
:
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
If you have HA (High availability) cluster, use this:
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability.yaml
Then use can use kubectl top nodes
or kubectl top pods -A
and get something like:
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%