[Kubernetes, kubernetes dashboard]

The Ultimate Guide to the Kubernetes Dashboard: How to Install and Integrate Metrics-server

Metrics-server replaces Heapster as the primary cluster-wide metrics aggregator for Kubernetes with an integration into the Kubernetes dashboard. In this blog post, we will go through the process of installing and integrating metrics-server into the Kubernetes dashboard.

Hasham Haider

Hasham Haider

July 23, 2019

7 minute read

We recently wrote a comprehensive blog post about the Kubernetes dashboard and the functionality it provides. The post covered the topics of installing, accessing and authenticating the dashboard as well as adding Heapster metrics. Heapster allows access to CPU and memory usage metrics for Kubernetes pods and nodes.

At this time Heapster was about to be deprecated and a replacement integration from metrics-server was being worked on by the Kubernetes community. Last week, the community released v2.0.0 of the Kubernetes dashboard, which includes the metrics-server integration as well as some additional features. The new version is in pre-release right now and is formally named as v2.0.0beta1.

Metrics-server aggregates resource consumption data like CPU and memory usage for Kubernetes nodes, pods and containers. These metrics are collected from the API exposed by the Kubelet on each node. With the new integration, the Kubernetes dashboard will be able to display metrics directly from metrics-server.

In this post, we will look at the process of installing metrics-server in a Kubernetes cluster as well as integrating it with the dashboard. Once installed we will then review some of the resource metrics that it allows us access to.

Before we do that, however, let’s first look at some of the new features that have been added to the dashboard as part of the v2.0.0 pre-release.

Looking to launch Kubernetes in Production? Download the Complete Production-Readiness Checklist with Checks, Recipes and Best Practices for Resource Management, Security, Scalability and Monitoring

Download Checklist

Kubernetes Dashboard: New Features

Besides the metrics-server integration, the new release bakes in support for metrics-scraper. Since metrics-server shows only a snapshot of metrics in the cluster the metrics-scraper has been added to aggregate and store metrics over time. Additionally, the kubernetes dashboard is now deployed by default in a new “kubernetes-dashboard” namespace as opposed to the kube-system namespace for previous versions. It can also be deployed to other namespaces.

Note: Before we move on to installing the Kubernetes dashboard and integrating the metrics-server into it, there are a couple of points that you need to be aware of. First off metrics-server now uses webhook authentication so for it to work properly, make sure Kubelet has webhook authentication enabled.

To do this, pass the following parameters to Kubelet, when creating the cluster:

anonymousAuth: false
authenticationTokenWebhook: true
authorizationMode: Webhook

If you have already created your cluster, edit your cluster: 

kops edit cluster

Add the following under to the cluster spec:

anonymousAuth: false
authenticationTokenWebhook: true
authorizationMode: Webhook

Then update the cluster:

kops update cluster mycluster.k8s.local


kops rolling-update cluster mycluster.k8s.local

Kubernetes Dashboard: Installing Latest Release

We assume that you have already have installed Kubectl.

Install the latest v2.0.0beta1 release of the Kubernetes dashboard:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta1/aio/deploy/recommended.yaml

The dashboard can also be deployed by saving this code into a kubernetes-dashboard.yaml file locally and then using

kubectl apply -f kubernetes-dashboard.yaml

As can be seen from the screenshot below, the kubectl command creates both the dashboard service and deployment.


It also launches the metrics-server scraper sidecar container in the kubernetes-dashboard namespace:

kubernetes-dashboard-install-deploy-metrics-scraperThis completes the dashboard installation. We can now access it using:

kubectl proxy

And browsing to the following URL:


This will take us on the login page for the Kubernetes dashboard. To access the dashboard we need to authenticate our account. We can do this using either the token or the kubeconfig authentication methods.

Using the token authentication method requires us to create a new service account for the dashboard. Do this using:

kubectl create serviceaccount dashboard-admin-sa

Bind the dashboard-admin-sa service account to the cluster-admin role

kubectl create clusterrolebinding dashboard-admin-sa --clusterrole=cluster-admin 

List secrets using:

kubectl get secrets


Use kubectl describe to get the access token:

kubectl describe secret dashboard-admin-sa-token-kw7vn

Copy the token and enter it into the token field on the Kubernetes dashboard login page.

We can now access the Kubernetes dashboard. Click on Nodes in the left hand panel under the Cluster section. This will take us to the overview page for all nodes that are part of our Kubernetes cluster. Next click on an individual node and scroll down to the pod section.


As you can see in the screenshot above the CPU Usage (cores) and Memory Usage (bytes) fields are empty for each pod. To get both these metrics, we first need to install metrics-server in our cluster.

Kubernetes Dashboard: Installing Metrics-Server

We will install metrics-server using Helm. Following is a quick walkthrough of Helm installation:

Head over here and download the latest version.

Unpack it:

tar -zxvf helm-v2.13.1-darwin-amd64.tar.gz

Move it to your bin directory:

mv darwin-amd64/helm /usr/local/bin/helm

Initialize helm and install tiller:

helm init

Create a service account:

kubectl create serviceaccount --namespace kube-system tiller

Bind the new service account to the cluster-admin role. This will give tiller admin access to the entire cluster:

kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin 

Deploy tiller and add the line serviceAccount: tiller to spec.template.spec:

kubectl patch deploy --namespace kube-system tiller-deploy 
-p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'

Next copy the following code into a crb-kubelet-api-admin.yaml file locally:

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
name: kubelet-api-admin
- kind: User
name: kubelet-api
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:kubelet-api-admin
apiGroup: rbac.authorization.k8s.io

And create the cluster role binding using:

kubectl apply -f crb-kubelet-api-admin.yaml

This CRB gives the kubelet-api user full access to the kubelet API.

Now we are ready to install metrics-server. Do this using: 

helm install --name metrics-server stable/metrics-server 
--namespace metrics --set args={"--kubelet-insecure-tls=true,

 Check the metrics-server pod running in the kube-system namespace using:

Kubectl get pods --namespace=kube-system


Once the installation is complete, browse back to the Kubernetes dashboard, click on nodes in the Cluster section and then click on an individual node.


As you can see in the screenshot above both the CPU usage (cores) and memory usage (bytes) are displayed for each pod.

We can also see pod resource usage metrics by clicking on pods under workloads in the left-hand panel. This will display all pods belonging to the namespace currently selected in the toggle menu in the left-hand panel, as well as their resource usage. 


To see all pods running in the cluster choose “all namespaces” from the toggle menu. From here we can also see the aggregated CPU and memory usage for the entire cluster, by clicking on Overview in the left-hand panel.


Toggle between namespaces in the toggle menu to see the CPU and memory usage for individual Namespaces:

Development Namespace:


Production Namespace:



The metrics-server integration replaces Heapster as the main metrics aggregator that can be integrated with the Kubernetes dashboard. It allows us access to basic resource usage metrics for Kubernetes pod,  containers and namespaces as well as aggregated cluster metrics for all namespaces. Node resource consumption metrics are missing as of now and are being worked upon by the community. Further along in the pipeline is a potential dashboard integration with Prometheus.

For a more extensive list of resource consumption metrics with support for nodes, namespaces, teams, departments and clients checkout the Replex Governance and Cost Management solution for Kubernetes. In addition to providing resource usage insights, Replex co-relates this usage with the costs of the underlying infrastructure to provide cost insights and enable organizations to allocate and showback Kubernetes costs. Organizations can also govern and manage Kubernetes costs based on real-time utilization metrics for clusters, nodes and teams.

logos of docker, mesos, and kubernetes and a green button

Kubernetes Production Readiness and Best Practices Checklist Kubernetes Production Readiness and Best Practices Checklist Cover Download Checklist
Hasham Haider


Hasham Haider

Fan of all things cloud, containers and micro-services!

Want to Dig Deeper and Understand How Different Teams or Applications are Driving Your Costs?

Request a quick 20 minute demo to see how you can seamlessly allocate Kubernetes costs while saving up to 30% on infrastructure costs using Replex.

Contact Us