Member-only story

Kubernetes Metrics Server

DaeGon Kim
2 min readJul 4, 2024

This short article describes how to deploy a Kubernetes metrics server that provide the following commands.

kubectl top node
kubectl top pod [-n namespace]

The metrics server collects CPU and memory metrics to support vertical and horizontal autoscaling based on these resources and is not recommended for monitoring purpose.

Deploying it Separately

First, we need to get metrics server component file.

https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml

Now, we can apply this file.

kubectl apply -f components.yaml

These are the deployed Kubernetes components.

The metrics server consists of these Kubernetes objects

The metrics server should be deployed in the kube-system namespace.

Soon after, the top commands should be available to use.

Deploying it with Kubespray

This can be done with updating the group vars. In the following file

inventory/[mycluster]/group_vars/k8s_cluster/addons.yml

there is a section titled Metrics Server deployment. We change metrics_server_enabled from false to true. There are other properties for the metrics server that can be…

--

--

No responses yet