We use optional first-party traffic analytics to improve the blog. You can accept or decline — nothing is measured before you choose.

Privacy policy

Skip to content
NyverraNyverra
⌘K
HomeArticlesCorporate site
🇺🇸
Nyverra

Editorial channel

Articles on technology, operations and partners — infrastructure, monitoring and critical environments.

Social media

Explore

  • Home
  • Articles
  • Categories
  • Tags
  • Authors
  • About
  • Contact
  • RSS
  • Corporate site

Nyverra

  • Our services
  • Case studies
  • Partners

Contact

Email[email protected]WhatsApp(62) 99309-1592Client portalITSM · tickets and SLA

Rua RB 18, S/N — Casa 01, Sala 01 · Residencial Buriti · Senador Canedo – GO, Brazil · ZIP 75260-459

Hours: Mon–Fri, 8am–6pm

© 2026 Nyverra. All rights reserved.

CNPJ: 61.571.209/0001-08 · State registration: 20.291.265-5 · D-U-N-S®: 57-323-5796

blog.nyverra.com.br

Terms of usePrivacyCookies
Back to top
  1. Home
  2. Kubernetes
  3. Kubernetes Course 13 — Observability: metrics-server, Prometheus and Grafana
Kubernetes
#Kubernetes#Curso Kubernetes#K8S#Observabilidade

Kubernetes Course 13 — Observability: metrics-server, Prometheus and Grafana

Wedson LopesWedson Lopes
31 de outubro de 20263 min de leitura

You cannot fix what you cannot see. Kubernetes generates a huge amount of signals; the hard part is choosing which ones matter.

Observability has three pillars:

Pillar Question Tools
Metrics “how much/what?” Prometheus, Grafana
Logs “why?” Loki, Elasticsearch
Traces “where?” OpenTelemetry, Jaeger

Course seal: tested on Kubernetes 1.35 with kube-prometheus-stack.

metrics-server: the kubectl top

The metrics-server collects CPU/memory from pods and nodes via the metrics API. It is what powers kubectl top and HPA based on CPU/memory.

kubectl top nodes
kubectl top pods -A --sort-by=memory | head

If it returns error: Metrics API not available, the metrics-server is not installed or has a TLS/RBAC problem.

Important: metrics-server is not long-term storage. It serves recent metrics for the HPA. For history, Prometheus.

Prometheus: the de facto standard

Prometheus does scrape (pulls metrics) over HTTP at regular intervals, stores them in TSDB and allows queries in PromQL.

Common components:

  • Prometheus: collects and stores.
  • node-exporter: node metrics (CPU, memory, disk, network).
  • kube-state-metrics: state of objects (pods, deployments, PDB).
  • Alertmanager: groups, silences and routes alerts.
  • Grafana: visualization.

Installation via Helm (lab):

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm upgrade --install kps prometheus-community/kube-prometheus-stack \
  -n monitoring --create-namespace \
  --set grafana.adminPassword='troque-isto'

Validate:

kubectl -n monitoring get pods
kubectl -n monitoring get servicemonitors

What to measure first

Don't try to measure everything. Start with what hurts:

Signal Example metric
Healthy nodes up{job="node-exporter"}
Ready pods kube_pod_status_ready
Restarts kube_pod_container_status_restarts_total
CPU/memory container_cpu_usage_seconds_total, container_memory_working_set_bytes
Disk node_filesystem_avail_bytes
API server apiserver_request_duration_seconds
HTTP errors http_server_requests_seconds_count{status=~"5.."}

Useful queries:

# nós down
up == 0

# pods que reiniciaram mais de 3 vezes na última hora
increase(kube_pod_container_status_restarts_total[1h]) > 3

# memória dos pods por namespace
sum by (namespace, pod) (container_memory_working_set_bytes{container!=""})

Grafana: dashboards that answer questions

A good dashboard answers:

  • Is the cluster healthy?
  • What changed in the last 24h?
  • Which service is degraded?
  • Are we within the SLO?

Avoid dashboards with 200 panels. Start with:

  1. Overview: nodes, pods, CPU, memory, disk.
  2. Namespace/application: replicas, restarts, latency, errors.
  3. SLO: availability and error budget.

Alerts: what to wake someone up

A good alert is actionable. Examples:

- alert: NodeDown
  expr: up{job="node-exporter"} == 0
  for: 2m
  labels:
    severity: critical
  annotations:
    summary: "Nó {{ $labels.instance }} down"

- alert: PodCrashLooping
  expr: increase(kube_pod_container_status_restarts_total[10m]) > 3
  for: 5m
  labels:
    severity: warning

Rules:

  • Every alert has a runbook.
  • for avoids noise.
  • Severity defines channel (critical wakes up; warning waits).
  • Alertmanager groups and silences during maintenance.

Logs and traces

  • Logs: structured (JSON), with traceId/requestId, defined retention. Loki is a lightweight option.
  • Traces: OpenTelemetry in the app, collector and backend (Jaeger/Tempo). Without sampling, cost explodes; start with 10%.

Common errors

Symptom Cause
kubectl top unavailable metrics-server down/TLS
Target down in Prometheus wrong ServiceMonitor/port/labels
Empty dashboard wrong datasource or renamed metric
Prometheus out of disk retention/TSDB without PVC
Alerts in loop for too short or rule without hysteresis
Cardinality exploding high cardinality labels (pod, request id)

Checklist

  • [ ] metrics-server working (kubectl top).
  • [ ] Prometheus with retention and PVC.
  • [ ] node-exporter and kube-state-metrics.
  • [ ] Cluster and application dashboards.
  • [ ] Alerts with severity and runbook.
  • [ ] Structured logs with correlation.
  • [ ] Tracing with defined sampling.

Glossary

  • scrape: periodic collection of metrics.
  • TSDB: time series database.
  • PromQL: query language.
  • ServiceMonitor: Prometheus Operator CRD.
  • SLO: service level objective.
  • cardinality: number of label combinations.

Next

Now that you can see the cluster, let's understand operators — what they do, when to use them and why they change the way you operate data.

Next: Kubernetes Course 14 — Operators: what they are and why use them

Share

Keep reading

Read also

  • Kubernetes Course 12 — ConfigMap, Secret, and the Credentials Guard
    Kubernetes

    Kubernetes Course 12 — ConfigMap, Secret, and the Credentials Guard

    Configuration without rebuilding the image — and why a Secret with a default value brought down an entire deployment. Best practices, rotation, and alternatives.

    31 de outubro de 20264 min de leitura
  • Kubernetes Course 15 — Postgres with CloudNativePG: HA, Failover, and Backup
    Kubernetes

    Kubernetes Course 15 — Postgres with CloudNativePG: HA, Failover, and Backup

    Database on Kubernetes with an operator: primary, replicas, failover, continuous backup, and tested restore — no guesswork.

    31 de outubro de 20264 min de leitura
  • Kubernetes Course 11 — Storage: PV, PVC, NFS, and local-path
    Kubernetes

    Kubernetes Course 11 — Storage: PV, PVC, NFS, and local-path

    Persistence in Kubernetes without mystery: PV, PVC, StorageClass, access modes, NFS, local-path and what happens when the pod changes nodes.

    31 de outubro de 20264 min de leitura

Nyverra

Need specialist help?

  • Infrastructure services
  • Case studies
  • Partners

Comments

No comments yet

Be the first to share your thoughts on this article.

Leave a comment

Newsletter

Get new articles

Subscribe to receive Nyverra blog posts in your inbox. We will send a confirmation link.

​