Skip to main content

Metrics-server installation

To install the "metrics-server" addon, download it in the Kubernetes environment. It can be obtained from its github project: 

https://github.com/kubernetes-incubator/metrics-server 

Once downloaded, deploy it through the "kubectl" command: 

kubectl apply -f metrics-server/deploy/1.8+/

You can verify that the deployment was successful if, upon launching the following command, the status of its API is "true": 

$ kubectl get apiservices | grep metrics-server 

v1beta1.metrics.k8s.io kube-system/metrics-server True 1m

If the deployment was successful, the "metrics-server" API should stay accessible: 

$ kubectl get --raw "/apis/metrics.k8s.io/v1beta1/" 

{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"metrics.k8s.io/v1beta1","res ources":[{"name":"nodes","singularName":"","namespaced":false,"kind":"NodeMetrics ","verbs":["get","list"]},{"name":"pods","singularName":"","namespaced":true,"kind":"P odMetrics","verbs":["get","list"]}]}

In addition, after a few seconds, it should be possible to obtain CPU and memory usage data of containers and nodes: 

$ kubectl top node 

NAME CPU(cores) CPU% MEMORY(bytes) MEMORY% 

kube 93m 4% 968Mi 56% 

$ kubectl top pod 

NAME CPU(cores) MEMORY(bytes) 

pod1 0m 3Mi 

pod2 0m 3Mi 

pod3 0m 2Mi 

pod4 0m 3Mi 

pod5 0m 1Mi