Docs

Metrics setup

SkoposIDE draws its CPU, memory, disk, network and control plane charts from what the cluster already runs: metrics-server, or a Prometheus-compatible API such as Prometheus or Grafana Mimir. This page lists the settings, the metrics each chart reads and how to check them.

Where metrics show

Each panel names its source on its first line, for example Prometheus observability/prometheus-operated:9090, autodetected, through the API server proxy, so you can see which backend answered.

Pick a source

Each cluster has one metrics source, chosen in its settings under Metrics. The default, Detect, finds one by itself.

ChoiceWhat it readsWhat you get
DetectA Prometheus Service in the cluster, else the metrics.k8s.io APIWhatever it finds, as below
Prometheus or Mimir in the clusterA Service you name, queried through the Kubernetes API server's service proxyEvery chart, with history from 1 hour to 7 days
Prometheus-compatible URLAn HTTP API outside the cluster, such as Mimir or Grafana Cloud, reached directlyEvery chart, with history
metrics-server onlyThe metrics.k8s.io API of metrics-serverCurrent CPU and memory only, sampled every 15 s while the panel is open; no history, disk, network or control plane
NoneNothingNo metrics for this cluster

How Detect chooses

  1. It lists the Services of every namespace you can read. When listing across namespaces is forbidden, it lists each namespace you can access.
  2. It keeps the Prometheus candidates, best first:
    • label app=kube-prometheus-stack-prometheus, port http-web (kube-prometheus-stack);
    • label operated-prometheus=true, port web (the Prometheus Operator's prometheus-operated);
    • labels app.kubernetes.io/name=prometheus and app.kubernetes.io/component=server, port http (the prometheus Helm chart);
    • label app.kubernetes.io/name=prometheus alone.
    Within a tier, the monitoring namespace comes first. Without the tier's port name it takes a port named web, http or http-web, then port 9090, then the first port.
  3. It asks each candidate /api/v1/query?query=up through the service proxy and takes the first one that answers within 5 s.
  4. With no Prometheus answering, it uses metrics-server when the API server serves /apis/metrics.k8s.io/v1beta1. Otherwise the cluster has no metrics.

The choice is kept for 10 minutes. Retry in the Metrics panel, or reconnecting the cluster, detects again. Detect never finds a URL outside the cluster: choose Prometheus-compatible URL for that.

The cluster's metrics settings

Open a cluster's settings from its row menu in the catalog (Settings), or with the Cluster settings button that metrics notes show. The settings stay in SkoposIDE, in clusters.json in its configuration folder; your kubeconfig is not changed. Passwords and tokens go to the operating system's keychain, never to that file.

The Metrics part of a cluster's settings, with Prometheus or Mimir in the cluster chosen and its Namespace, Service, Port, Scheme, Path prefix, Tenant and Cluster label fields
The Metrics settings on the design canvas, with Prometheus or Mimir in the cluster chosen.

Prometheus or Mimir in the cluster

FieldWhat to enter
NamespaceThe Service's namespace, a lowercase DNS label such as monitoring.
ServiceThe Service's name, such as prometheus-operated or kube-prometheus-stack-prometheus.
PortThe Service port, 1 to 65535, such as 9090.
SchemeHTTP or HTTPS: how the API server's proxy talks to the Service.
Path prefixEmpty for Prometheus. /prometheus for Mimir and other APIs served under a path. It starts with /.
TenantSent as the X-Scope-OrgID header, for Mimir and other multi-tenant APIs. Empty for none. Up to 150 letters, digits and ! - _ . * ' ( ).
Cluster labelA label name and value, such as cluster = prod, added to every query. Set it when one backend holds the metrics of several clusters. Both or neither.

Queries go to /api/v1/namespaces/<namespace>/services/[<scheme>:]<service>:<port>/proxy<path prefix>/api/v1/query_range on the API server, with your own kubeconfig credentials. You need get on services/proxy in that namespace, and create too for very long queries, which go as a POST.

Prometheus-compatible URL

FieldWhat to enter
URLThe API's base, the part before /api/v1, such as https://mimir.example.com/prometheus. http or https with a host, without a user name, query or fragment.
TenantAs above, sent as X-Scope-OrgID.
Cluster labelAs above. Usually needed here, since a shared backend holds many clusters.
AuthenticationNone, Basic (username and password), Bearer (token) or Client certificate (certificate and key files). Basic and Bearer need https, except to localhost; a client certificate always needs https.
CA fileA PEM file to trust for a private certificate authority. Optional.

Certificate, key and CA files are absolute paths to PEM files, read when you save.

The metrics each chart reads

With Prometheus or a URL, the charts read these series. They come from the usual exporters: cAdvisor through the kubelet, kube-state-metrics, node-exporter and the API server. kube-prometheus-stack, and the prometheus chart with its default subcharts, scrape all of them.

ChartSeriesExported by
Pod and workload CPUcontainer_cpu_usage_seconds_totalkubelet (cAdvisor)
Pod and workload memorycontainer_memory_working_set_byteskubelet (cAdvisor)
Pod networkcontainer_network_receive_bytes_total, container_network_transmit_bytes_totalkubelet (cAdvisor)
Pod filesystemcontainer_fs_reads_bytes_total, container_fs_writes_bytes_total, container_fs_usage_byteskubelet (cAdvisor)
Requests and limitskube_pod_container_resource_requests, kube_pod_container_resource_limits, kube_pod_status_phasekube-state-metrics
Cluster and Node CPUnode_cpu_seconds_totalnode-exporter
Cluster and Node memorynode_memory_MemTotal_bytes, node_memory_MemAvailable_bytesnode-exporter
Disknode_filesystem_size_bytes, node_filesystem_avail_bytes for /, else /varnode-exporter
Which Node a series is fromnode_uname_info (its nodename label)node-exporter
Capacity and Podskube_node_status_allocatable, kube_node_status_capacity, kube_pod_infokube-state-metrics
Volume usagekubelet_volume_stats_used_bytes, kubelet_volume_stats_capacity_byteskubelet
API requests and latencyapiserver_request_total, apiserver_request_duration_seconds_bucketAPI server
etcd latency and sizeetcd_request_duration_seconds_bucket, apiserver_storage_size_bytes or etcd_db_total_size_in_bytesAPI server

Install a source

Any one of these is enough. Detect finds each of them with no settings. SkoposIDE can install the charts from its Helm screens too.

metrics-server: current CPU and memory

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

On clusters whose kubelets have self-signed serving certificates, such as kind, add --kubelet-insecure-tls to the metrics-server container's arguments.

kube-prometheus-stack: every chart

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack \
  --namespace monitoring --create-namespace

Grafana Mimir or another shared backend

Have each cluster's Prometheus or agent add an external label such as cluster: prod to what it sends. Then choose Prometheus-compatible URL, or Prometheus or Mimir in the cluster with Path prefix /prometheus, and set Tenant and Cluster label to match.

Check the cluster

Run these with the same kubeconfig context SkoposIDE uses. Replace monitoring, the Service and the port with yours.

metrics-server

kubectl get apiservice v1beta1.metrics.k8s.io    # AVAILABLE must be True
kubectl top nodes
kubectl top pods -A

Prometheus through the API server

kubectl get services -A -l app.kubernetes.io/name=prometheus
kubectl auth can-i get services/proxy -n monitoring
kubectl get --raw '/api/v1/namespaces/monitoring/services/kube-prometheus-stack-prometheus:9090/proxy/api/v1/query?query=up'

The answer is JSON with "status":"success". Then ask for one series of each exporter; an empty result means that exporter is missing or not scraped:

…/proxy/api/v1/query?query=count(container_cpu_usage_seconds_total)
…/proxy/api/v1/query?query=count(kube_pod_container_resource_requests)
…/proxy/api/v1/query?query=count(node_cpu_seconds_total)
…/proxy/api/v1/query?query=count(apiserver_request_total)

A URL with a tenant and a cluster label

curl -H 'X-Scope-OrgID: team-a' \
  'https://mimir.example.com/prometheus/api/v1/query?query=count(up%7Bcluster%3D%22prod%22%7D)'

Messages and what to check

The panel saysCheck
No metrics provider answers in ‹cluster›: there is no Prometheus Service and the metrics.k8s.io API is not served.Install metrics-server or Prometheus, or choose a source in the settings.
Metrics are off: the metrics provider is None in the cluster settings.Choose another source under Metrics.
Reading Prometheus needs permission to get services/proxy in namespace ‹namespace›Ask for get and create on services/proxy in that namespace.
Mimir needs a tenant: set Tenant in this cluster's metrics settings.Set Tenant.
‹host› has no Prometheus API at ‹URL›: check the path.The URL or Path prefix, often /prometheus.
‹host› refused the credentials (HTTP 401).Authentication: the username, password, token or certificate.
Prometheus did not answer within 15sThe Service, port and scheme; the Pods behind the Service.
the service answered, but not like PrometheusThe port or Path prefix points at something else.
No samples for tenant ‹tenant› with ‹label›: check the tenant and the cluster label in the cluster settings.Tenant and Cluster label must match what the backend stores.
Pods, disk and control plane history need Prometheus: metrics-server reports only the current CPU and memory.Expected with metrics-server. Install Prometheus for history.
Collecting samples: metrics-server is read every 15 s, the next sample arrives in ‹n› s.Nothing: the chart fills while it is open.