Enable the Kubernetes Metrics Server with Talos Linux

Find out how to establish a Kubernetes Metrics server on your Talos Linux environment.

This is useful for when you want to check the CPU and/or memory usage in the terminal with kubectl top or by exporting the metrics on a dashboard with Prometheus and Grafana.

Tip
You can do this before installing Talos, or if you have already installed it, do it with talosctl edit machineconfig.

This configuration has to be done just on the control plane node in your cluster. It will also enable automatic kubelet certificate rotation. Here is the configuration (click to expand):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
machine:
  kubelet:
    extraArgs:
      rotate-server-certificates: true

  files:
    - content: |
        [metrics]
          address = "0.0.0.0:11234"        
      path: /var/cri/conf.d/metrics.toml
      op: create

cluster:
  extraManifests:
    - https://raw.githubusercontent.com/alex1989hu/kubelet-serving-cert-approver/main/deploy/standalone-install.yaml
    - https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml

This configuration has to be done on every other node in your cluster. Here is the configuration (click to expand):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
machine:
  kubelet:
    extraArgs:
      rotate-server-certificates: true

  files:
    - content: |
        [metrics]
          address = "0.0.0.0:11234"        
      path: /var/cri/conf.d/metrics.toml
      op: create