How to configure Metrics Server on kubeadm provisioned Kubernetes cluster?

Metrics server is the kubernetes cluster-wide aggregator of resource usage data. Let me take you the steps for configuration on bare metal. The official documentation has some missing links. Kubernetes installed through kubeadm doesn’t have the metrics server installed by default. Also it does not guarantee secure communication as the certificates generated by kubeadm are self-signed. Below is the step-by-step guide.

Orchestration

Clone the repos using this link.

Modify the metrics-server-deployment as below. (Modifications highlighted):

spec:

serviceAccountName: metrics-server

volumes:

# mount in tmp so we can safely use from-scratch images and/or read-only containers

- name: tmp-dir

emptyDir: {}

hostAliases:

- hostnames:

- k8smaster

ip: 10.0.0.45

- hostnames:

- k8sworker1

ip: 10.0.0.46 #Mention all worker node’s hostname and ip.

containers:

- name: metrics-server

image: k8s.gcr.io/metrics-server-amd64:v0.3.1

command:

- /metrics-server

-— kubelet-preferred-address-types=InternalDNS,InternalIP,ExternalDNS,ExternalIP,Hostname

- — kubelet-insecure-tls

Now deploy the server using below command:

# Kubernetes > 1.8

$ kubectl create -f deploy/1.8+/

Wait for few minutes for metric server and API to distribute and fetch relevant information.

Now verify your deployment using:

Kubectl top nodes

Kubectl top pods

DevOps Specialist