Skip to content

Metrics Server AddOn

Metrics Server is a scalable, efficient source of container resource metrics for Kubernetes built-in autoscaling pipelines. It is not deployed by default in Amazon EKS clusters. The Metrics Server is commonly used by other Kubernetes add ons, such as the Horizontal Pod Autoscaler, Vertical Autoscaling or the Kubernetes Dashboard.

Important: Don't use Metrics Server when you need an accurate source of resource usage metrics or as a monitoring solution.



import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import * as blueprints from '@aws-quickstart/eks-blueprints';

const app = new cdk.App();

const addOn = new blueprints.addons.MetricsServerAddOn('v0.5.0');

const blueprint = blueprints.EksBlueprint.builder()
  .build(app, 'my-stack-name');

Once deployed, you can see metrics-server pod in the kube-system namespace.

$ kubectl get deployments -n kube-system

NAME                                                          READY   UP-TO-DATE   AVAILABLE   AGE
blueprints-addon-metrics-server                               1/1     1            1           20m


  1. Deploys the metrics-server helm chart in kube-system namespace by default.
  2. Supports standard helm configuration options.
  3. Supports createNamespace configuration to deploy the addon to a customized namespace.

Testing with Kubernetes Dashboard

For testing, we will use the Kubernetes Dashboard to view CPU and memory metrics of our cluster.

Apply the kubernetes dashboard manifest.

$ kubectl apply -f

namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created created created created created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
deployment.apps/dashboard-metrics-scraper created

Create a file called eks-admin-service-account.yaml with the text below. This manifest defines a service account and cluster role binding called eks-admin.

$ cat << 'EOF' >> eks-admin-service-account.yaml
apiVersion: v1
kind: ServiceAccount
  name: eks-admin
  namespace: kube-system
kind: ClusterRoleBinding
  name: eks-admin
  kind: ClusterRole
  name: cluster-admin
- kind: ServiceAccount
  name: eks-admin
  namespace: kube-system

Apply the service account and cluster role binding to your cluster.

$ kubectl apply -f eks-admin-service-account.yaml

serviceaccount/eks-admin created created

Retrieve an authentication token for the eks-admin service account. Copy the value from the output. You use this token to connect to the dashboard.

$ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep eks-admin | awk '{print $1}')

Name:         eks-admin-token-dwzb2
Namespace:    kube-system
Labels:       <none>
Annotations: eks-admin


ca.crt:     1066 bytes
namespace:  11 bytes

Start the kubectl proxy.

$ kubectl proxy

Open the dashboard in your browser and login using the value for token above.


Note: It may take a few minutes before CPU and memory metrics appear in the dashboard