# Metrics-server installation

<span style="font-weight: 400;">To install the "</span>*<span style="font-weight: 400;">metrics-server</span>*<span style="font-weight: 400;">" addon, download it in the Kubernetes environment. It can be obtained from its github project: </span>

<span style="font-weight: 400;">https://github.com/kubernetes-incubator/metrics-server</span><span style="font-weight: 400;"> </span>

<span style="font-weight: 400;">Once downloaded, deploy it through the "</span>*<span style="font-weight: 400;">kubectl</span>*<span style="font-weight: 400;">" command: </span>

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

<span style="font-weight: 400;">You can verify that the deployment was successful if, upon launching the following command, the status of its API is "</span>*<span style="font-weight: 400;">true</span>*<span style="font-weight: 400;">": </span>

```
$ kubectl get apiservices | grep metrics-server 

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

<span style="font-weight: 400;">If the deployment was successful, the "</span>*<span style="font-weight: 400;">metrics-server</span>*<span style="font-weight: 400;">" API should stay accessible: </span>

```
$ 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"]}]}
```

<span style="font-weight: 400;">In addition, after a few seconds, it should be possible to obtain CPU and memory usage data of containers and nodes: </span>

```
$ 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
```