Troubleshooting
Real monitoring, logging and tracing failures with exact error text, diagnosis commands and fixes
Prometheus scraping and targets
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q1 A target shows DOWN on /targets with Get "http://10.0.3.14:9100/metrics": context deadline exceeded
Beginner
DOWN on /targets with Get "http://10.0.3.14:9100/metrics": context deadline exceededLikely causes โ The exporter is too slow to answer inside scrape_timeout (default 10s), a security group / NetworkPolicy drops packets, or the host is overloaded.
Diagnose โ
time curl -s -o /dev/null -w '%{http_code}\n' http://10.0.3.14:9100/metrics
# from inside the Prometheus pod/host
kubectl exec -n monitoring prometheus-k8s-0 -c prometheus -- wget -qO- -T 5 http://10.0.3.14:9100/metrics | headCheck scrape_duration_seconds{instance="10.0.3.14:9100"} against the timeout.
Fix โ Open the port (SG/NACL/NetworkPolicy), disable slow collectors (e.g. node_exporter --no-collector.hwmon on hosts where it hangs), or raise scrape_timeout (must stay โค scrape_interval).
Prevent โ Alert on up == 0 and on scrape_duration_seconds > 0.8 * scrape_timeout.
Q2 Target is DOWN with server returned HTTP status 401 Unauthorized
Beginner
DOWN with server returned HTTP status 401 UnauthorizedLikely causes โ The endpoint needs auth and the scrape config has none, the token/password rotated, or the wrong Secret is mounted.
Diagnose โ
curl -i http://app:8080/metrics # 401 confirms auth required
curl -i -H "Authorization: Bearer $TOKEN" http://app:8080/metricsFix โ Add credentials to the job:
- job_name: app
authorization:
type: Bearer
credentials_file: /etc/prometheus/secrets/app-token
# or basic_auth: { username: prom, password_file: /etc/prometheus/secrets/pw }Use *_file fields so rotation does not need a config edit, then reload.
Prevent โ Alert on up == 0 per job; keep scrape creds in a secret manager with rotation hooks.
Q3 Target shows server returned HTTP status 403 Forbidden when scraping kubelet / cAdvisor
Intermediate
server returned HTTP status 403 Forbidden when scraping kubelet / cAdvisorLikely causes โ The Prometheus ServiceAccount lacks RBAC for nodes/metrics or nodes/proxy, or the kubelet has webhook authorization on and the token is not bound.
Diagnose โ
kubectl auth can-i get nodes/metrics --as=system:serviceaccount:monitoring:prometheus-k8s
kubectl auth can-i get nodes/proxy --as=system:serviceaccount:monitoring:prometheus-k8sFix โ Grant a ClusterRole with nodes, nodes/metrics, services, endpoints, pods (get/list/watch) and nonResourceURLs: ["/metrics"], bound to the SA. Use bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token.
Prevent โ Install via kube-prometheus-stack, which ships correct RBAC, and test with kubectl auth can-i in CI.
Q4 Target is DOWN with connect: connection refused
Beginner
DOWN with connect: connection refusedLikely causes โ Nothing listens on that port, the app binds to 127.0.0.1 only, or the exporter crashed.
Diagnose โ
ss -lntp | grep 9100
systemctl status node_exporter
curl -v http://<ip>:9100/metricsFix โ Start the exporter, bind to 0.0.0.0:<port> (e.g. --web.listen-address=:9100), or correct the port in the scrape config / Service.
Prevent โ Run exporters under systemd with Restart=always; alert on up == 0 for 5m.
Q5 Target shows x509: certificate signed by unknown authority
Intermediate
x509: certificate signed by unknown authorityLikely causes โ The endpoint uses an internal CA that Prometheus does not trust.
Diagnose โ
openssl s_client -connect app:8443 -showcerts </dev/null | openssl x509 -noout -issuer -subject -datesFix โ
scheme: https
tls_config:
ca_file: /etc/prometheus/certs/internal-ca.pem
server_name: app.internalinsecure_skip_verify: true only as a short-term workaround.
Prevent โ Distribute the internal CA bundle via cert-manager trust-manager or config management.
Q6 Target shows x509: certificate is valid for app.svc, not 10.0.4.22
Intermediate
x509: certificate is valid for app.svc, not 10.0.4.22Likely causes โ Service discovery gives Prometheus a pod IP, but the cert SANs only contain DNS names.
Diagnose โ Compare the __address__ on /targets with SANs: openssl s_client -connect 10.0.4.22:8443 </dev/null | openssl x509 -noout -ext subjectAltName.
Fix โ Set tls_config.server_name: app.svc so verification uses the DNS name while connecting to the IP, or add IP SANs to the cert.
Prevent โ Standardise on server_name for every TLS job scraped by IP.
Q7 A target is UP but /targets shows expected a valid start token, got "<" ("INVALID") while parsing: "<"
Intermediate
UP but /targets shows expected a valid start token, got "<" ("INVALID") while parsing: "<"Likely causes โ The path returns HTML (login page, 404 page, SPA index) instead of exposition format. Usually wrong metrics_path or an auth proxy redirect.
Diagnose โ
curl -sL http://app:8080/metrics | head -5
curl -sI http://app:8080/metrics # look for 302 to /loginFix โ Point metrics_path at the real endpoint (/actuator/prometheus for Spring Boot, /metrics for most others), or exempt it from the auth proxy.
Prevent โ Add a smoke test that runs promtool check metrics against the endpoint in CI.
Q8 A target disappeared from /targets entirely after a config change
Beginner
/targets entirely after a config changeLikely causes โ A relabel_configs keep/drop rule filtered it, the reload failed silently, or service discovery no longer finds it.
Diagnose โ Open /service-discovery in the UI: dropped targets are listed with their discovered labels. Then:
promtool check config /etc/prometheus/prometheus.yml
curl -s localhost:9090/api/v1/status/config | headCheck prometheus_config_last_reload_successful.
Fix โ Correct the relabel regex (anchored by default: regex: web does not match web-1), fix the config and reload with curl -X POST localhost:9090/-/reload (needs --web.enable-lifecycle).
Prevent โ Run promtool check config in CI and alert on prometheus_config_last_reload_successful == 0.
Q9 Prometheus logs Error reloading config ... "job_name" is duplicated and keeps the old config
Beginner
Error reloading config ... "job_name" is duplicated and keeps the old configLikely causes โ Two scrape jobs share a job_name (often from merged include files or Helm additionalScrapeConfigs).
Diagnose โ
promtool check config prometheus.yml
grep -n 'job_name' prometheus.yml | sort -k3 | uniq -d -f2Fix โ Rename one job; job names must be unique across all scrape_configs and scrape_config_files.
Prevent โ Gate merges with promtool check config; alert on failed reloads.
Q10 Scrape errors show body size limit exceeded
Intermediate
body size limit exceededLikely causes โ body_size_limit is set on the job and the exporter response grew past it, usually due to a new high-cardinality metric.
Diagnose โ
curl -s http://app:8080/metrics | wc -c
curl -s http://app:8080/metrics | grep -v '^#' | cut -d'{' -f1 | sort | uniq -c | sort -rn | headFix โ Remove the offending labels in the app, or drop them via metric_relabel_configs. Only raise the limit once the growth is understood.
Prevent โ Keep body_size_limit and sample_limit on every job as a guardrail.
Q11 Scrape fails with sample limit exceeded and the whole target goes to up == 0
Intermediate
sample limit exceeded and the whole target goes to up == 0Likely causes โ The target exposes more series than sample_limit. When the limit is exceeded, the whole scrape is rejected, not just the excess.
Diagnose โ
scrape_samples_scraped{job="app"}
scrape_samples_post_metric_relabeling{job="app"}Inspect which metric names exploded with the curl | cut | uniq -c trick.
Fix โ Drop or aggregate the high-cardinality series with metric_relabel_configs (action: drop or labeldrop), fix instrumentation, then adjust the limit deliberately.
Prevent โ Alert when scrape_samples_scraped / <limit> > 0.8.
Q12 Prometheus logs Error on ingesting samples with different value but same timestamp
Advanced
Error on ingesting samples with different value but same timestampLikely causes โ Two targets produce identical label sets after relabeling (e.g. you dropped instance or pod), or one exporter emits the same series twice with explicit timestamps.
Diagnose โ
rate(prometheus_target_scrapes_sample_duplicate_timestamp_total[5m]) > 0Check /targets for two endpoints with the same job/instance after relabeling.
Fix โ Keep a unique label per target (instance, pod). Fix exporters that print a series twice.
Prevent โ Never labeldrop identity labels; review relabel rules against /service-discovery output.
Q13 Prometheus logs Error on ingesting out-of-order samples with num_dropped=...
Advanced
Error on ingesting out-of-order samples with num_dropped=...Likely causes โ An exporter attaches its own timestamps that go backwards, two sources write the same series (duplicate targets or two remote-writers), or a pushed timestamp is older than the TSDB head allows.
Diagnose โ
rate(prometheus_target_scrapes_sample_out_of_order_total[5m])
rate(prometheus_tsdb_out_of_order_samples_total[5m])curl the target and look for explicit timestamps at the end of sample lines.
Fix โ Remove explicit timestamps (or set honor_timestamps: false), dedupe targets, and give each writer a unique external label. If legitimate late data exists, enable storage.tsdb.out_of_order_time_window (e.g. 30m).
Prevent โ One series, one writer. Alert on the counters above.
Q14 Remote write receiver (Mimir/Cortex/Thanos Receive) returns out of order sample
Advanced
out of order sampleLikely causes โ Two Prometheus replicas in an HA pair write identical series without dedup, or a replica restarted and replays old WAL data after newer samples were accepted.
Diagnose โ Check the sender: prometheus_remote_storage_samples_failed_total and logs server returned HTTP status 400 Bad Request: ... out of order sample. Confirm both replicas have the same external_labels.
Fix โ Give HA replicas external_labels: {cluster: prod, __replica__: a|b} and enable HA dedup in the receiver (Mimir: accept_ha_samples with ha_cluster_label/ha_replica_label). Or enable out-of-order ingestion on the receiver for a bounded window.
Prevent โ Treat 400s as non-retryable data loss: alert on rate(prometheus_remote_storage_samples_failed_total[5m]) > 0.
Q15 EC2 service discovery finds no targets; logs show could not describe instances: AccessDenied
Intermediate
could not describe instances: AccessDeniedLikely causes โ The Prometheus IAM role lacks ec2:DescribeInstances / ec2:DescribeAvailabilityZones, or the wrong region is configured.
Diagnose โ
aws sts get-caller-identity
aws ec2 describe-instances --region ap-south-1 --max-items 1Fix โ Attach a policy with ec2:DescribeInstances and ec2:DescribeAvailabilityZones; set region: in ec2_sd_configs; filter with filters: [{name: "tag:monitor", values: ["true"]}].
Prevent โ Alert on prometheus_sd_discovered_targets dropping to 0 for a job.
Q16 EC2 targets are discovered but all scrape the public IP and time out
Intermediate
Likely causes โ Relabeling uses __meta_ec2_public_ip, or the default address is wrong for your network path.
Diagnose โ Look at discovered labels on /service-discovery and compare __address__ with __meta_ec2_private_ip.
Fix โ
relabel_configs:
- source_labels: [__meta_ec2_private_ip]
target_label: __address__
replacement: '${1}:9100'
- source_labels: [__meta_ec2_tag_Name]
target_label: instancePrevent โ Template SD jobs and review relabeling against the SD page before merging.
Q17 file_sd_configs targets never change even though the JSON file was updated
Beginner
file_sd_configs targets never change even though the JSON file was updatedLikely causes โ The file was written outside the watched glob, the JSON is invalid (Prometheus keeps the last good version), or a ConfigMap update has not propagated yet.
Diagnose โ
jq . /etc/prometheus/file_sd/nodes.json
journalctl -u prometheus | grep -i 'file_sd\|discovery'Check prometheus_sd_file_read_errors_total.
Fix โ Write files atomically (write temp, then mv), fix JSON, and make sure the glob in files: matches.
Prevent โ Alert on increase(prometheus_sd_file_read_errors_total[10m]) > 0.
Q18 Blackbox exporter probe shows probe_success 0 but the site loads in a browser
Intermediate
probe_success 0 but the site loads in a browserLikely causes โ The module expects a different status code, follows no redirects, fails on IPv6 preference, or the probe target is passed as __address__ instead of __param_target.
Diagnose โ
curl 'http://blackbox:9115/probe?module=http_2xx&target=https://example.com&debug=true'The debug output shows each step and the failing reason.
Fix โ Use correct relabeling (__address__ โ __param_target, then __address__ = blackbox host), set preferred_ip_protocol: ip4, and valid_status_codes: [200, 301, 302] if needed.
Prevent โ Keep a debug probe link in each alert's annotations.
Q19 node_exporter scrape takes 25 seconds on some hosts
Intermediate
Likely causes โ A collector is stuck: filesystem on a hung NFS mount, hwmon, or a huge textfile directory.
Diagnose โ
topk(5, node_scrape_collector_duration_seconds)
node_scrape_collector_success == 0timeout 5 stat -f /mnt/nfs || echo "mount hung"Fix โ Exclude the mount: --collector.filesystem.mount-points-exclude='^/(mnt/nfs|proc|sys)($|/)', or disable the slow collector.
Prevent โ Alert on per-collector duration and failures.
Q20 Pushgateway shows stale metrics from a batch job that stopped running a week ago
Beginner
Likely causes โ Pushgateway never expires groups; the last push persists until deleted.
Diagnose โ
curl -s http://pushgateway:9091/metrics | grep push_time_secondsFix โ Delete the group: curl -X DELETE http://pushgateway:9091/metrics/job/nightly_backup/instance/db1. Alert on freshness instead of the value:
time() - push_time_seconds{job="nightly_backup"} > 26*3600Prevent โ Use honor_labels: true on the Pushgateway job and only use it for batch jobs, never for long-running services.
Q21 All Pushgateway metrics show instance="pushgateway:9091" and job="pushgateway" instead of the pushed values
Intermediate
instance="pushgateway:9091" and job="pushgateway" instead of the pushed valuesLikely causes โ honor_labels is false, so the scraped job/instance labels are renamed to exported_job/exported_instance.
Diagnose โ Query {exported_job!=""} and you will see the original labels.
Fix โ Set honor_labels: true on the Pushgateway scrape job (or honorLabels: true in the ServiceMonitor endpoint).
Prevent โ Template the Pushgateway job once and reuse it.
Q22 Federation job returns context deadline exceeded from the global Prometheus
Advanced
context deadline exceeded from the global PrometheusLikely causes โ The match[] selector pulls too many series (e.g. {job=~".+"}), so /federate cannot respond in time.
Diagnose โ
time curl -sG 'http://prom-a:9090/federate' --data-urlencode 'match[]={__name__=~"job:.*"}' | wc -lFix โ Federate only aggregated recording rules (match[]={__name__=~"job:.*|cluster:.*"}), raise scrape_timeout modestly, and shard by job.
Prevent โ For global views at scale use Thanos/Mimir remote write or sidecar instead of federating raw series.
Q23 up is 1 but a specific metric is missing from the target
Beginner
up is 1 but a specific metric is missing from the targetLikely causes โ The app has not registered the metric yet (lazy init until first event), a metric_relabel_configs rule dropped it, or the name changed in a library upgrade (e.g. _total suffix added).
Diagnose โ
curl -s http://app:8080/metrics | grep -i requestCompare with the metric_relabel_configs of the job.
Fix โ Initialise counters at zero for known label values in code, fix the drop rule, update queries to the new name.
Prevent โ Pre-initialise metrics and test exposition in CI.
Q24 Prometheus logs Scrape commit failed ... err="out of bounds"
Advanced
Scrape commit failed ... err="out of bounds"Likely causes โ Samples carry timestamps older than the head block's lower bound, usually from exporters with explicit old timestamps or a host clock far behind.
Diagnose โ
timedatectl status # on Prometheus and target hosts
chronyc trackingrate(prometheus_target_scrapes_sample_out_of_bounds_total[5m])Fix โ Fix NTP/chrony on hosts, set honor_timestamps: false for exporters with bad timestamps.
Prevent โ Alert on node_timex_offset_seconds and enforce chrony everywhere.
Q25 /targets shows hundreds of targets for a job that should have 6
Intermediate
/targets shows hundreds of targets for a job that should have 6Likely causes โ Kubernetes SD with role: pod scrapes every container port of every pod, or no keep rule on annotations/labels.
Diagnose โ Look at /service-discovery labels: __meta_kubernetes_pod_container_port_number, __meta_kubernetes_namespace.
Fix โ
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: "true"
- source_labels: [__meta_kubernetes_pod_container_port_name]
action: keep
regex: metricsPrevent โ Prefer role: endpoints or ServiceMonitors with named ports.
Prometheus storage, memory and cardinality
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q26 Prometheus pod restarts with OOMKilled every few hours
Intermediate
OOMKilled every few hoursLikely causes โ Too many active series in the head block (cardinality growth), heavy queries loading long ranges, or memory limits sized for last year's load.
Diagnose โ
kubectl describe pod prometheus-k8s-0 -n monitoring | grep -A3 'Last State'prometheus_tsdb_head_series
topk(10, count by (__name__)({__name__=~".+"}))Use Status โ TSDB Status for top series by metric and label.
Fix โ Drop the offending series with metric_relabel_configs, add query limits (--query.max-samples), and size memory at roughly a few KB per active series plus query headroom.
Prevent โ Alert on prometheus_tsdb_head_series growth and per-job scrape_series_added.
Q27 A query fails with query processing would load too many samples into memory in query execution
Intermediate
query processing would load too many samples into memory in query executionLikely causes โ The query touches more samples than --query.max-samples (default 50,000,000), usually a long range over a high-cardinality metric with a small step.
Diagnose โ Re-run with a shorter range and check count(<selector>) to see the series count.
Fix โ Add label filters, aggregate earlier (sum by (job) (rate(...))), use a recording rule, or increase the step. Raise the limit only if memory allows.
Prevent โ Back expensive dashboard panels with recording rules.
Q28 Head series jumped from 2M to 9M after a deploy
Advanced
Likely causes โ A new label with unbounded values: user_id, request_id, raw URL path, trace_id, error message, or pod churn from a crash loop.
Diagnose โ
topk(10, sum by (job) (scrape_series_added))
count by (__name__)({job="checkout"})
count(count by (path) (http_requests_total{job="checkout"}))TSDB Status page lists "Top 10 label names with high value count".
Fix โ Short term: drop the label at ingest:
metric_relabel_configs:
- action: labeldrop
regex: pathLong term: route templating in code (/users/:id, not /users/42) and roll back the instrumentation change.
Prevent โ sample_limit per job, a cardinality budget per team, and review of new metrics in PRs.
Q29 Prometheus logs opening storage failed: ... unexpected EOF / corruption in segment and won't start
Advanced
opening storage failed: ... unexpected EOF / corruption in segment and won't startLikely causes โ WAL corruption after an unclean shutdown, node crash, full disk, or a storage layer that does not honour fsync (NFS).
Diagnose โ
kubectl logs prometheus-k8s-0 -c prometheus --previous | grep -i 'wal\|corrupt'
ls -la /prometheus/wal/
df -h /prometheusFix โ Recent versions attempt WAL repair automatically and truncate at the corrupt record. If it still fails, back up the directory, then move the bad segment(s) out of wal/ (you lose recent un-compacted samples, up to ~2h) and restart.
Prevent โ Use local SSD or block volumes (EBS), never NFS; keep disk headroom; give pods a long terminationGracePeriodSeconds so the WAL closes cleanly.
Q30 Prometheus is in CrashLoopBackOff with no space left on device
Beginner
no space left on deviceLikely causes โ Retention by time only (--storage.tsdb.retention.time=30d) while ingest grew, so disk filled before old blocks expired.
Diagnose โ
kubectl exec prometheus-k8s-0 -c prometheus -- du -sh /prometheus/* | sort -hprometheus_tsdb_storage_blocks_bytesFix โ Expand the PVC (if the StorageClass allows allowVolumeExpansion), or delete the oldest block directories, then add --storage.tsdb.retention.size=180GB (about 80โ85% of the volume).
Prevent โ Set both retention flags and alert on predict_linear(kubelet_volume_stats_available_bytes[6h], 24*3600) < 0.
Q31 Prometheus takes 15 minutes to become ready after a restart
Advanced
Likely causes โ WAL replay of a large head block. Time scales with active series and WAL size.
Diagnose โ Logs show Replaying WAL progress; check du -sh /prometheus/wal and prometheus_tsdb_head_series.
Fix โ Reduce cardinality, give more CPU during startup, enable --enable-feature=memory-snapshot-on-shutdown so clean restarts load a snapshot instead of replaying the full WAL.
Prevent โ Raise readiness probe failureThreshold so Kubernetes does not kill it mid-replay, and run HA pairs.
Q32 Prometheus is killed by the liveness probe during startup in a loop
Intermediate
Likely causes โ WAL replay exceeds the probe budget, the kubelet restarts it, replay starts again from scratch.
Diagnose โ kubectl describe pod shows Liveness probe failed followed by restarts; logs end during Replaying WAL.
Fix โ Add a startupProbe with a generous failureThreshold * periodSeconds (e.g. 60 ร 15s), or temporarily remove the liveness probe.
Prevent โ Size probes for worst-case replay; the Prometheus Operator already sets a startupProbe in recent versions.
Q33 Compaction fails with compaction failed ... overlapping blocks
Advanced
compaction failed ... overlapping blocksLikely causes โ Blocks with overlapping time ranges, often from backfilling with promtool tsdb create-blocks-from or copying blocks from another instance.
Diagnose โ
promtool tsdb list /prometheusLook for blocks whose MinTime/MaxTime ranges overlap.
Fix โ Vertical compaction handles overlaps in Prometheus 2.39+ by default. On older versions, remove or move the overlapping backfilled blocks and re-backfill into non-overlapping windows.
Prevent โ Backfill into a staging directory, validate with promtool tsdb analyze, then move blocks in.
Q34 Remote write logs Skipping resharding, last successful send was beyond threshold and the queue keeps growing
Advanced
Skipping resharding, last successful send was beyond threshold and the queue keeps growingLikely causes โ The receiver is slow or rejecting, network latency is high, or max_shards is too low for the ingest rate.
Diagnose โ
prometheus_remote_storage_highest_timestamp_in_seconds - ignoring(remote_name, url) group_right prometheus_remote_storage_queue_highest_sent_timestamp_seconds
prometheus_remote_storage_shards_desired
rate(prometheus_remote_storage_samples_retried_total[5m])Fix โ Fix receiver health first; then tune queue_config (max_shards, capacity, max_samples_per_send: 2000+). Drop unneeded series with write_relabel_configs.
Prevent โ Alert when remote write lag exceeds a few minutes; the WAL only covers ~2h of buffering.
Q35 Remote write logs server returned HTTP status 429 Too Many Requests: per-user series limit of 150000 exceeded
Intermediate
server returned HTTP status 429 Too Many Requests: per-user series limit of 150000 exceededLikely causes โ The tenant hit the receiver's per-tenant series or ingestion rate limit (Mimir/Cortex/Grafana Cloud).
Diagnose โ Check prometheus_remote_storage_samples_failed_total and receiver per-tenant limit dashboards; compare with prometheus_tsdb_head_series.
Fix โ Drop unneeded series via write_relabel_configs, or raise max_global_series_per_user / ingestion rate for the tenant.
Prevent โ Track per-tenant usage vs limits and alert at 80%.
Q36 Disk usage on Prometheus grows faster than ingestion suggests
Intermediate
Likely causes โ Compaction is failing so many small 2h blocks pile up, churn is high (new series every deploy), or retention is not applied.
Diagnose โ
increase(prometheus_tsdb_compactions_failed_total[1d])
rate(prometheus_tsdb_head_series_created_total[1h])promtool tsdb list -r /prometheus | headFix โ Resolve compaction errors (check logs), reduce churn (drop pod_template_hash-style labels when not needed), verify retention flags.
Prevent โ Alert on compaction failures and on series churn.
Q37 promtool tsdb analyze shows a label with 1.2M unique values
Intermediate
promtool tsdb analyze shows a label with 1.2M unique valuesLikely causes โ An unbounded value used as a label: IPs, session IDs, full URLs, timestamps.
Diagnose โ
promtool tsdb analyze /prometheus | sed -n '/Highest cardinality labels/,/^$/p'Fix โ Remove it from instrumentation; meanwhile labeldrop it or drop the metric. If you need the detail, put it in logs or traces and link via exemplars.
Prevent โ Lint metrics in code review; labels should have bounded values (tens to hundreds).
Q38 Histogram metrics alone account for 60% of all series
Advanced
Likely causes โ Classic histograms with many buckets (รlabels). 20 buckets ร 50 routes ร 10 status codes ร 30 pods = 300k series for one metric.
Diagnose โ
topk(10, count by (__name__)({__name__=~".+_bucket"}))Fix โ Cut buckets to what your SLOs need, drop the le buckets you never query, remove status from histograms (keep it on counters), or migrate to native histograms (--enable-feature=native-histograms, one series per histogram).
Prevent โ Standard bucket presets in a shared instrumentation library.
Q39 Prometheus CPU is pegged at 100% but ingestion is flat
Intermediate
Likely causes โ Expensive queries: dashboards auto-refreshing every 5s over 7d, regex matchers like {__name__=~".*"}, or slow rule groups.
Diagnose โ Enable --query.active-query-tracker/query log (global.query_log_file), then:
topk(10, prometheus_rule_group_last_duration_seconds)
rate(prometheus_engine_query_duration_seconds_sum[5m])Fix โ Increase dashboard refresh intervals, replace hot queries with recording rules, and kill bad ones.
Prevent โ Put a query frontend (Thanos/Mimir) with caching in front for heavy dashboards.
Q40 Thanos Compactor logs critical error detected; halting and stops compacting
Advanced
critical error detected; halting and stops compactingLikely causes โ Overlapping blocks in the bucket (two sidecars with identical external labels), or a corrupt block.
Diagnose โ
thanos tools bucket verify --objstore.config-file=bucket.yml
thanos tools bucket inspect --objstore.config-file=bucket.ymlCheck thanos_compact_halted == 1.
Fix โ Give each Prometheus unique external_labels (including replica), mark the bad block with thanos tools bucket mark --marker=no-compact-mark.json or delete it, then restart the compactor. Use --deduplication.replica-label=replica.
Prevent โ Alert on thanos_compact_halted, and run exactly one compactor per bucket.
Q41 Thanos Query shows duplicated series from HA Prometheus pairs
Intermediate
Likely causes โ The replica label name passed to Querier does not match the external label used by Prometheus.
Diagnose โ Query the metric and look for two series differing only by prometheus_replica (or replica).
Fix โ Start Querier with --query.replica-label=prometheus_replica (match exactly) and keep dedup enabled in the UI.
Prevent โ Standardise external label names across clusters.
Q42 Thanos Store Gateway is OOMKilled on startup
Advanced
Likely causes โ It loads index headers for every block in a large bucket, or blocks were never downsampled/compacted.
Diagnose โ Count blocks with thanos tools bucket inspect; check thanos_bucket_store_blocks_loaded.
Fix โ Shard stores by time (--min-time=-30d --max-time=-2d) or by hash relabel, enable compactor downsampling, give the store fast local disk for index-header cache.
Prevent โ Keep the compactor healthy; it is the main lever on store memory.
Q43 Prometheus logs too many open files
Intermediate
too many open filesLikely causes โ The process file descriptor limit is too low for the number of blocks, WAL segments and scrape connections.
Diagnose โ
cat /proc/$(pgrep prometheus)/limits | grep 'open files'
ls /proc/$(pgrep prometheus)/fd | wc -lprocess_open_fds / process_max_fdsFix โ Set LimitNOFILE=65536 in the systemd unit or raise container ulimits.
Prevent โ Alert on process_open_fds / process_max_fds > 0.8.
Q44 After a Prometheus upgrade, queries for http_requests_total return nothing but http_requests_total_total exists
Beginner
http_requests_total return nothing but http_requests_total_total existsLikely causes โ The app's client library or an OTel-to-Prometheus conversion appended _total to a counter that already ended in _total, or a library upgrade changed naming.
Diagnose โ
{__name__=~"http_requests.*"}Fix โ Rename the counter in code to http_requests (library adds _total), or set the OTel exporter/translation option correctly. Update dashboards with a temporary or query during migration.
Prevent โ Pin client libraries and review metric names after upgrades.
Q45 Recording rule results disappear for 5 minutes after each Prometheus restart
Intermediate
Likely causes โ Normal behaviour: rule evaluation needs enough raw data in the range (rate(x[5m]) needs 2 samples inside 5m), and gaps appear while Prometheus is down.
Diagnose โ Compare the gap with the pod restart time.
Fix โ Run Prometheus as an HA pair and query through Thanos/Mimir with dedup so one replica covers the other's gap.
Prevent โ Use for: on alerts so a short gap does not resolve and re-fire alerts.
Q46 prometheus_tsdb_head_series is stable, but prometheus_tsdb_head_series_created_total rate is very high
Advanced
prometheus_tsdb_head_series is stable, but prometheus_tsdb_head_series_created_total rate is very highLikely causes โ Series churn: labels whose value changes over time (pod names in constant redeploys, version labels, Kubernetes Jobs/CronJobs). Each new series costs memory until the head is compacted.
Diagnose โ
topk(10, sum by (job) (rate(scrape_series_added[1h])))Fix โ Drop churning labels you do not query, aggregate away pod in recording rules, stop CronJob pods from being scraped individually if not needed.
Prevent โ Track churn per job as a capacity metric.
Q47 VictoriaMetrics / Prometheus-compatible backend logs cannot parse sample: too long label value
Intermediate
cannot parse sample: too long label valueLikely causes โ A label carries a huge string (SQL query, stack trace, JSON blob).
Diagnose โ Find the source: curl -s app/metrics | awk 'length > 1000' | head.
Fix โ Remove that label in the app; drop it at scrape with labeldrop. Configure label_value_length_limit on the scrape job so Prometheus rejects it early.
Prevent โ Set label_limit, label_name_length_limit and label_value_length_limit as global defaults.
Q48 Snapshot via /api/v1/admin/tsdb/snapshot returns 404 page not found
Beginner
/api/v1/admin/tsdb/snapshot returns 404 page not foundLikely causes โ Admin APIs are disabled by default.
Diagnose โ curl -XPOST localhost:9090/api/v1/admin/tsdb/snapshot returns 404 or "admin APIs disabled".
Fix โ Start with --web.enable-admin-api (Operator: enableAdminAPI: true), take the snapshot, then disable again.
Prevent โ Keep admin APIs off in normal operation and protect the endpoint.
Q49 Deleting a series with the admin API did not free disk
Intermediate
Likely causes โ delete_series only writes tombstones; data is removed at the next compaction.
Diagnose โ promtool tsdb list shows blocks unchanged in size.
Fix โ
curl -XPOST 'localhost:9090/api/v1/admin/tsdb/clean_tombstones'Prevent โ Drop bad series at ingest instead of deleting after the fact.
Q50 Prometheus on Kubernetes loses all data on every pod reschedule
Beginner
Likely causes โ Storage is emptyDir because no storageSpec/PVC was configured.
Diagnose โ
kubectl get pod prometheus-k8s-0 -n monitoring -o jsonpath='{.spec.volumes}' | jq
kubectl get pvc -n monitoringFix โ In the Prometheus CR set:
storage:
volumeClaimTemplate:
spec:
storageClassName: gp3
resources: { requests: { storage: 200Gi } }Prevent โ Make persistent storage a required value in your Helm values review.
PromQL and recording rules
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q51 A PromQL query in the UI returns Empty query result for a metric you can see on /metrics
Beginner
Empty query result for a metric you can see on /metricsLikely causes โ The target is not actually scraped by this Prometheus, label values differ from what you typed (job="api" vs job="api-svc"), or the time range is before the target was added.
Diagnose โ
up{job=~".*api.*"}
count by (job, instance) ({__name__="http_requests_total"})Drop label matchers one at a time until results appear.
Fix โ Use the real label values (autocomplete in Grafana Explore helps), or add the scrape job.
Prevent โ Use label value variables in dashboards instead of hardcoded strings.
Q52 rate(http_requests_total[1m]) returns nothing but http_requests_total has data
Beginner
rate(http_requests_total[1m]) returns nothing but http_requests_total has dataLikely causes โ The range window holds fewer than 2 samples. With scrape_interval: 60s, a 1m window often has only one sample.
Diagnose โ count_over_time(http_requests_total[1m]) returns 1 or less.
Fix โ Use a window of at least 4ร the scrape interval ([4m] for 60s scrapes), or $__rate_interval in Grafana.
Prevent โ Standardise on $__rate_interval in all dashboard panels.
Q53 rate() applied to a gauge shows huge spikes
Beginner
rate() applied to a gauge shows huge spikesLikely causes โ rate() assumes a monotonically increasing counter; every decrease in a gauge is treated as a counter reset, producing big fake increases.
Diagnose โ Check # TYPE on the metric's /metrics output.
Fix โ For gauges use deriv(), delta(), avg_over_time() or the raw value. Use rate()/increase() only on counters (_total, _count, _sum, _bucket).
Prevent โ Follow naming conventions so types are obvious.
Q54 Binary operation fails: many-to-many matching not allowed: matching labels must be unique on one side
Advanced
many-to-many matching not allowed: matching labels must be unique on one sideLikely causes โ Both sides have multiple series per match group, often when joining with kube_pod_info or kube_pod_labels which can have duplicates during pod restarts or from two kube-state-metrics replicas.
Diagnose โ
count by (namespace, pod) (kube_pod_info) > 1Fix โ Aggregate the "one" side first and use explicit matching:
sum by (namespace, pod) (rate(container_cpu_usage_seconds_total[5m]))
* on (namespace, pod) group_left(node)
max by (namespace, pod, node) (kube_pod_info)Prevent โ Run one kube-state-metrics per cluster (or shard properly) and always wrap join sides in max by.
Q55 found duplicate series for the match group {pod="api-1"} on the right hand-side of the operation
Intermediate
found duplicate series for the match group {pod="api-1"} on the right hand-side of the operationLikely causes โ group_left expects one series per match group on the right; there are two (e.g. different instance or job labels from two scrape paths).
Diagnose โ Run the right-hand side alone and look for duplicates on the on(...) labels.
Fix โ Reduce the right side with max by (pod, <labels you need>), or add the differing label to on(...).
Prevent โ Avoid scraping the same exporter through two jobs.
Q56 Error ratio query returns no data during quiet hours
Intermediate
Likely causes โ When there are no errors, the status=~"5.." series do not exist yet, so the numerator is empty and the division returns nothing.
Diagnose โ Run numerator and denominator separately.
Fix โ
(sum(rate(http_requests_total{status=~"5.."}[5m])) or vector(0))
/
sum(rate(http_requests_total[5m]))Or initialise counters for known status classes in code.
Prevent โ Pre-initialise label combinations you alert on.
Q57 histogram_quantile returns NaN
Intermediate
histogram_quantile returns NaNLikely causes โ No requests in the window (all bucket rates are 0), so the quantile is undefined.
Diagnose โ sum(rate(http_request_duration_seconds_count[5m])) is 0.
Fix โ Accept it as "no traffic", or filter: ... and sum(rate(..._count[5m])) > 0. In Grafana, set the panel to show NaN as null/gap.
Prevent โ Alerts on latency should be combined with a minimum traffic condition.
Q58 p99 latency is reported as exactly 10 seconds for hours
Intermediate
10 seconds for hoursLikely causes โ Requests exceed the highest finite bucket; histogram_quantile returns the upper bound of the last finite bucket when the quantile lands in +Inf.
Diagnose โ
sum by (le) (rate(http_request_duration_seconds_bucket[5m]))Look at how many observations sit above the top le.
Fix โ Add higher buckets (e.g. 15, 30, 60) or move to native histograms.
Prevent โ Design buckets around SLO thresholds plus headroom above the timeout.
Q59 histogram_quantile result jumps wildly between refreshes
Advanced
histogram_quantile result jumps wildly between refreshesLikely causes โ le was dropped or aggregated incorrectly (sum without(le)), buckets are mixed across services with different boundaries, or the window is too short for low traffic.
Diagnose โ Check the inner expression keeps le: sum by (le, service) (rate(..._bucket[5m])).
Fix โ Always aggregate with by (le, ...), do not mix histograms with different bucket layouts, widen the window.
Prevent โ Wrap quantile queries in recording rules such as service:http_request_duration_seconds:p99_5m.
Q60 Recording rule never produces data; /rules shows health err with vector contains metrics with the same labelset after applying rule labels
Advanced
/rules shows health err with vector contains metrics with the same labelset after applying rule labelsLikely causes โ The expression returns several series that become identical once __name__ is replaced and rule labels: are applied (e.g. rate(x[5m]) across two jobs then a job label is overwritten).
Diagnose โ Run the expression in the UI; check which labels differ between series.
Fix โ Aggregate explicitly: sum by (service) (...) so output labels are unique, or stop overwriting a distinguishing label.
Prevent โ Lint rules with promtool check rules and unit-test them with promtool test rules.
Q61 promtool check rules fails with group "api": duplicate rule or YAML errors
Beginner
promtool check rules fails with group "api": duplicate rule or YAML errorsLikely causes โ Duplicate record/alert names within a group, tabs in YAML, or a multi-line expr without |.
Diagnose โ
promtool check rules rules/*.yml
yamllint rules/Fix โ Rename duplicates, use spaces, and write long expressions as expr: | blocks.
Prevent โ Run promtool check rules and promtool test rules in CI for every rules PR.
Q62 Rule group evaluation is slower than its interval; prometheus_rule_group_iterations_missed_total is increasing
Advanced
prometheus_rule_group_iterations_missed_total is increasingLikely causes โ Rules within a group run sequentially; a few heavy queries exceed the 1m interval, so iterations are skipped.
Diagnose โ
prometheus_rule_group_last_duration_seconds > prometheus_rule_group_interval_seconds
topk(10, prometheus_rule_evaluation_duration_seconds)Fix โ Split heavy rules into separate groups (groups evaluate concurrently), layer recording rules (5m base โ 1h derived), increase group interval for slow-moving rules.
Prevent โ Alert on missed iterations.
Q63 increase(errors_total[1h]) shows 2.97 even though errors are whole numbers
Beginner
increase(errors_total[1h]) shows 2.97 even though errors are whole numbersLikely causes โ Expected. increase() extrapolates to the window edges, so results are fractional.
Diagnose โ Compare with errors_total - errors_total offset 1h for a rough raw difference.
Fix โ Round for display (round(increase(...[1h]))) and do not treat it as an exact count.
Prevent โ For exact counts use logs or a billing-grade system, not Prometheus.
Q64 Query fails with parse error: unexpected character inside braces: '-'
Beginner
parse error: unexpected character inside braces: '-'Likely causes โ A label name contains characters PromQL does not allow unquoted, or quotes are missing around a value.
Diagnose โ Check the selector: {app-name=checkout} is invalid.
Fix โ Label values must be quoted: {app="checkout"}. Label names must match [a-zA-Z_][a-zA-Z0-9_]*; fix the label at relabel time (labelmap converts unsupported characters to _ for Kubernetes labels).
Prevent โ Use Grafana's query builder or autocomplete.
Q65 absent(up{job="payments"}) alert never fires even though the job is gone
Intermediate
absent(up{job="payments"}) alert never fires even though the job is goneLikely causes โ Another series still matches (e.g. a second Prometheus federates it, or a stale instance still returns up=0 which is not "absent").
Diagnose โ Run up{job="payments"} and check what is returned.
Fix โ Alert on both conditions:
absent(up{job="payments"} == 1)This fires when no healthy target exists.
Prevent โ Pair up == 0 alerts with absent-style alerts for critical jobs.
Q66 A Grafana panel and the Prometheus UI show different values for the same query
Intermediate
Likely causes โ Different step: Grafana computes step from the panel width and Min interval, which changes how rate() windows align; or Grafana is querying a different data source / Thanos with downsampling.
Diagnose โ In Grafana Query inspector check the actual step, start, end, and the data source URL.
Fix โ Use $__rate_interval, set Min interval to the scrape interval, and confirm the data source.
Prevent โ Document data sources clearly in dashboard descriptions.
Q67 topk(5, ...) shows more than 5 series on a graph
Beginner
topk(5, ...) shows more than 5 series on a graphLikely causes โ topk is evaluated per step in a range query, so different series win at different times.
Diagnose โ Run as an instant query; you get exactly 5.
Fix โ For a stable set, pick the top 5 over the whole range with a variable, or use topk(5, avg_over_time(...[$__range])) as an instant query in a table panel.
Prevent โ Explain this in the panel description; it surprises everyone once.
Q68 sum(rate(container_cpu_usage_seconds_total[5m])) is double what kubectl top shows
Intermediate
sum(rate(container_cpu_usage_seconds_total[5m])) is double what kubectl top showsLikely causes โ cAdvisor exposes pod-level cgroup series (container="") and the pause container (container="POD") alongside each container.
Diagnose โ
count by (container) (container_cpu_usage_seconds_total{namespace="shop"})Fix โ
sum by (namespace, pod) (rate(container_cpu_usage_seconds_total{container!="", container!="POD", image!=""}[5m]))Prevent โ Use the kube-prometheus recording rules (node_namespace_pod_container:container_cpu_usage_seconds_total:sum_rate5m).
Q69 Memory dashboard uses container_memory_usage_bytes and shows pods near limit, yet no OOMKills happen
Intermediate
container_memory_usage_bytes and shows pods near limit, yet no OOMKills happenLikely causes โ usage_bytes includes page cache that the kernel can reclaim. OOM decisions are based on working set.
Diagnose โ Compare container_memory_working_set_bytes and container_memory_rss for the same pod.
Fix โ Use container_memory_working_set_bytes for limit-based alerts and dashboards.
Prevent โ Standardise memory panels across teams.
Q70 predict_linear disk-full alert fires constantly on log volumes
Intermediate
predict_linear disk-full alert fires constantly on log volumesLikely causes โ Logrotate makes usage sawtooth; a short window extrapolates each growth spike as if it continues.
Diagnose โ Plot node_filesystem_avail_bytes for the mount over 24h.
Fix โ Use a longer window and a minimum free threshold together:
predict_linear(node_filesystem_avail_bytes{mountpoint="/var/log"}[6h], 4*3600) < 0
and node_filesystem_avail_bytes{mountpoint="/var/log"} / node_filesystem_size_bytes < 0.2Prevent โ Add for: 30m.
Q71 Query with offset 1w returns empty while the current value exists
Beginner
offset 1w returns empty while the current value existsLikely causes โ Retention is shorter than one week, or the series did not exist then (label change, renamed metric).
Diagnose โ Check --storage.tsdb.retention.time on /flags and prometheus_tsdb_lowest_timestamp.
Fix โ Query long-term storage (Thanos/Mimir), or extend retention.
Prevent โ Keep week-over-week comparisons on a long-term store.
Q72 Subquery max_over_time(rate(x[5m])[1d:]) is extremely slow
Advanced
max_over_time(rate(x[5m])[1d:]) is extremely slowLikely causes โ Without an explicit resolution, the subquery uses the global evaluation interval, computing rate at thousands of points per series.
Diagnose โ Check query time in the Prometheus UI stats and the series count.
Fix โ Set resolution [1d:5m], or better, create a recording rule for rate(x[5m]) and run max_over_time over that.
Prevent โ Ban raw subqueries in alerts; use recording rules.
Q73 Stale series keep showing on a graph for 5 minutes after a pod is deleted
Beginner
Likely causes โ Lookback delta (default 5m) or the target was removed without a stale marker (e.g. Prometheus restarted at the same time).
Diagnose โ Check if the line flattens then ends ~5m later.
Fix โ Usually normal. Prometheus writes stale markers when a target disappears from SD, so series end quickly; if not, reduce --query.lookback-delta carefully.
Prevent โ Understand lookback before tuning it; shorter values break sparse metrics.
Q74 label_replace does not change anything
Intermediate
label_replace does not change anythingLikely causes โ The regex does not match the full value (it is anchored), or source and destination arguments are swapped.
Diagnose โ Signature: label_replace(v, dst_label, replacement, src_label, regex).
Fix โ
label_replace(up, "host", "$1", "instance", "([^:]+):.*")Prevent โ Test regexes on real values before saving recording rules.
Q75 promtool test rules fails with expected: ... got: nil for an alert test
Advanced
promtool test rules fails with expected: ... got: nil for an alert testLikely causes โ eval_time is earlier than the alert's for duration allows, input series intervals are wrong, or labels in exp_labels miss rule-added labels like severity.
Diagnose โ Run the alert expression in the test file as a promql_expr_test to see raw output at eval_time.
Fix โ Set eval_time past for (e.g. for: 5m โ eval_time: 10m), use series notation like '0+10x20', and list every label including rule labels.
Prevent โ Keep a test file per rule file and run it in CI.
Alerting and Alertmanager
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q76 An alert shows Pending in Prometheus but never goes to Firing
Beginner
Pending in Prometheus but never goes to FiringLikely causes โ The condition does not stay true for the full for: duration; a single evaluation dip resets the timer.
Diagnose โ Graph the alert expression for the last hour and check for gaps or dips.
Fix โ Smooth the expression (avg_over_time, longer rate window), or shorten for. Prometheus 2.42+ also supports keep_firing_for to stop flapping on resolve.
Prevent โ Use windows long enough that one missed scrape does not reset the alert.
Q77 An alert is Firing in Prometheus but nothing reaches Alertmanager
Intermediate
Firing in Prometheus but nothing reaches AlertmanagerLikely causes โ No alerting.alertmanagers configured, wrong address, or Operator alerting section points at the wrong Service/port.
Diagnose โ
prometheus_notifications_alertmanagers_discovered
rate(prometheus_notifications_errors_total[5m])
rate(prometheus_notifications_dropped_total[5m])Check Status โ Runtime & Build Info for the Alertmanager list.
Fix โ Point alerting.alertmanagers at the Alertmanager service (port 9093, or the named port web in the Operator).
Prevent โ Alert on prometheus_notifications_alertmanagers_discovered < 1, and run a Watchdog alert to a dead man's switch.
Q78 Alertmanager shows the alert but Slack receives nothing
Beginner
Likely causes โ The route matches a different receiver, the webhook URL is wrong or revoked, or the channel is not the one the webhook is bound to.
Diagnose โ
amtool config routes test --config.file=alertmanager.yml severity=critical team=payments
kubectl logs alertmanager-main-0 -c alertmanager | grep -i 'notify\|slack'rate(alertmanager_notifications_failed_total{integration="slack"}[5m])Fix โ Correct routing matchers and api_url/api_url_file. Test the webhook directly with curl -X POST -H 'Content-type: application/json' --data '{"text":"test"}' $WEBHOOK.
Prevent โ Alert on alertmanager_notifications_failed_total via a second channel (email/PagerDuty).
Q79 Alertmanager logs notify retry canceled due to unrecoverable error after 1 attempts: channel_not_found
Intermediate
notify retry canceled due to unrecoverable error after 1 attempts: channel_not_foundLikely causes โ Using a bot token (api_url: https://slack.com/api/chat.postMessage) with a channel the app is not a member of, or a typo in channel:.
Diagnose โ Check the channel: value and whether the Slack app is invited.
Fix โ /invite @alertmanager-bot in the channel, or use an incoming webhook bound to that channel.
Prevent โ Keep receivers in version control and test them after Slack workspace changes.
Q80 Alertmanager logs unexpected status code 404: no_service / invalid_token for Slack
Beginner
unexpected status code 404: no_service / invalid_token for SlackLikely causes โ The incoming webhook was deleted or rotated, or the Secret has a trailing newline.
Diagnose โ
kubectl get secret alertmanager-slack -n monitoring -o jsonpath='{.data.url}' | base64 -d | od -c | tail -2Fix โ Create a new webhook, store it without newline (printf '%s'), reference it via api_url_file.
Prevent โ Track webhook ownership; a departing admin can revoke it.
Q81 Alertmanager fails to load config: yaml: unmarshal errors: field matchers not found in type config.plain
Intermediate
yaml: unmarshal errors: field matchers not found in type config.plainLikely causes โ Alertmanager version is older than the config syntax (matchers: arrived in 0.22), or indentation puts it at the wrong level.
Diagnose โ
amtool check-config alertmanager.yml
alertmanager --versionFix โ Upgrade Alertmanager or use the old match/match_re form; fix indentation.
Prevent โ Run amtool check-config in CI with the same version as production.
Q82 Alerts fire constantly: the same alert re-notifies every 5 minutes
Beginner
Likely causes โ repeat_interval is too low, or the alert flaps (resolves and re-fires), creating new notifications.
Diagnose โ Check alert history in Prometheus (ALERTS{alertname="X"}) and Alertmanager route timings.
Fix โ Set sensible timings:
route:
group_wait: 30s
group_interval: 5m
repeat_interval: 4hAdd keep_firing_for on flapping rules.
Prevent โ Review the top noisy alerts weekly.
Q83 One incident sends 200 separate Slack messages
Intermediate
Likely causes โ group_by includes high-variety labels (instance, pod) or is missing, so each alert is its own group.
Diagnose โ amtool alert query and look at the groups in the Alertmanager UI.
Fix โ group_by: [alertname, cluster, namespace] and add inhibition rules (e.g. NodeDown inhibits pod alerts on that node).
Prevent โ Design grouping per team route, not at the root only.
Q84 Duplicate notifications arrive from an HA Alertmanager cluster
Advanced
Likely causes โ Peers are not clustered (gossip port 9094 blocked or wrong --cluster.peer), so each instance notifies independently. Or Prometheus sends to a load-balanced VIP instead of all instances.
Diagnose โ
alertmanager_cluster_members
alertmanager_cluster_failed_peersUI Status page shows cluster peers.
Fix โ Open TCP+UDP 9094 between peers, set --cluster.peer for each, and configure Prometheus to send to every Alertmanager individually.
Prevent โ Alert when alertmanager_cluster_members is below the expected count.
Q85 A silence was created but the alert still notifies
Intermediate
Likely causes โ Matchers do not match exactly (label value differs, regex not anchored as you think), or the silence was created on one Alertmanager that is not clustered.
Diagnose โ
amtool silence query
amtool alert query alertname=HighLatencyCompare labels with the silence matchers.
Fix โ Recreate with exact labels: amtool silence add alertname=HighLatency service=checkout --duration=2h --comment="deploy". Fix clustering if needed.
Prevent โ Create silences from the alert's "Silence" button so labels are pre-filled.
Q86 Inhibition rule does not suppress target alerts
Advanced
Likely causes โ The equal: labels are missing on one side (e.g. cluster exists on the source but not the target), or the source alert is not firing in the same Alertmanager.
Diagnose โ Compare label sets of the source and target alerts in the UI.
Fix โ
inhibit_rules:
- source_matchers: [alertname="NodeDown"]
target_matchers: [severity=~"warning|critical"]
equal: [cluster, node]Ensure both alerts carry cluster and node.
Prevent โ Add consistent external labels and test inhibition with synthetic alerts via amtool alert add.
Q87 Alerts arrive with an empty summary like [FIRING:1] ()
Beginner
[FIRING:1] ()Likely causes โ The template references annotations/labels that the rule does not set (.CommonAnnotations.summary), or a typo in the template.
Diagnose โ Check the rule's annotations: and the receiver template.
Fix โ Add summary and description annotations to every rule; test templates with amtool template render --template.glob=templates/*.tmpl --template.text='{{ template "slack.title" . }}'.
Prevent โ Enforce required annotations (summary, runbook_url) with a rule linter in CI.
Q88 Alertmanager logs template: ... executing "slack.default.text" ... map has no entry for key
Intermediate
template: ... executing "slack.default.text" ... map has no entry for keyLikely causes โ Custom template indexes a label that some alerts lack.
Diagnose โ Find the alert missing the label in the UI.
Fix โ Guard the template: {{ if .Labels.service }}{{ .Labels.service }}{{ else }}unknown{{ end }}, or use {{ index .Labels "service" }} which returns empty instead of failing.
Prevent โ Render templates against sample alerts in CI.
Q89 PagerDuty never receives alerts; Alertmanager logs unexpected status code 400 ... Event object is invalid
Intermediate
unexpected status code 400 ... Event object is invalidLikely causes โ Using service_key (Events API v1) with an Events API v2 integration key, or the payload exceeds limits from huge annotations.
Diagnose โ Check the integration type in PagerDuty and the receiver config.
Fix โ For v2 integrations use routing_key: (or routing_key_file). Trim large annotation fields.
Prevent โ Test receivers with amtool alert add in staging.
Q90 Email receiver fails with *smtp.plainAuth auth: unencrypted connection
Intermediate
*smtp.plainAuth auth: unencrypted connectionLikely causes โ SMTP PLAIN auth over a non-TLS connection is refused by Go's client.
Diagnose โ Check smarthost port and require_tls.
Fix โ Use port 587 with STARTTLS (require_tls: true, default) or 465 with TLS. For an internal relay without auth, remove auth_username/auth_password.
Prevent โ Prefer API-based receivers (SES via webhook, Slack, PagerDuty) over raw SMTP.
Q91 Alert resolves in Slack and immediately fires again
Intermediate
Likely causes โ Prometheus misses an evaluation or a scrape (target restarting), the expression briefly becomes false, Alertmanager sends resolved, then the alert fires again.
Diagnose โ Graph ALERTS{alertname="X"} and check scrape gaps around the flip.
Fix โ Add keep_firing_for: 10m to the rule, widen the rate window, set send_resolved: false for noisy, low-value receivers.
Prevent โ Track flap counts per alert.
Q92 Alerts stop being sent after Alertmanager restarts and then all old ones re-fire
Intermediate
Likely causes โ Alertmanager stores silences and notification log on disk (--storage.path); with emptyDir and a single replica, state is lost on restart.
Diagnose โ Check pod volumes and whether silences disappeared.
Fix โ Run 3 clustered replicas (state is gossiped) and/or use a PVC for storage.
Prevent โ Treat Alertmanager as stateful.
Q93 Watchdog alert stopped arriving at the dead man's switch
Advanced
Watchdog alert stopped arriving at the dead man's switchLikely causes โ The whole pipeline is broken somewhere: Prometheus down, rule not loaded, Alertmanager can't send, or the Watchdog route was swallowed by a null receiver.
Diagnose โ
amtool config routes test --config.file=alertmanager.yml alertname=Watchdog
curl -s localhost:9090/api/v1/rules | jq '.data.groups[].rules[] | select(.name=="Watchdog")'Fix โ Fix whichever stage failed; route Watchdog first with continue: false to the heartbeat receiver (healthchecks.io, PagerDuty heartbeat, Opsgenie heartbeat).
Prevent โ Exactly this alert is the prevention; make sure its receiver pages when heartbeats stop.
Q94 Alerts route to the default receiver even though a team route exists
Intermediate
Likely causes โ Route order: an earlier sibling route matches first and has continue: false (default), or the team label is missing on the alert.
Diagnose โ
amtool config routes show --config.file=alertmanager.yml
amtool config routes test --config.file=alertmanager.yml --verify.receivers=payments-slack team=payments severity=criticalFix โ Reorder routes (specific first), add missing team labels to rules, use continue: true where an alert should reach multiple receivers.
Prevent โ Keep route tests in CI.
Q95 AlertmanagerConfig CR in a namespace has no effect
Advanced
AlertmanagerConfig CR in a namespace has no effectLikely causes โ The Alertmanager CR's alertmanagerConfigSelector / alertmanagerConfigNamespaceSelector does not match the CR, or the Operator rejected it as invalid.
Diagnose โ
kubectl get alertmanager -n monitoring -o yaml | grep -A5 alertmanagerConfig
kubectl logs -n monitoring deploy/prometheus-operator | grep -i alertmanagerconfig
kubectl get secret alertmanager-main-generated -n monitoring -o jsonpath='{.data.alertmanager\.yaml\.gz}' | base64 -d | gunzip | lessFix โ Label the CR to match the selector. Remember the Operator adds a namespace matcher to every route in that CR, so alerts must carry the matching namespace label.
Prevent โ Document the required labels for team-owned AlertmanagerConfigs.
Q96 Alert rule never loads; /rules does not list it
Beginner
/rules does not list itLikely causes โ The file is not in rule_files glob, Prometheus was not reloaded, or (Operator) the PrometheusRule lacks the label the ruleSelector expects.
Diagnose โ
curl -s localhost:9090/api/v1/rules | jq '.data.groups[].name'
kubectl get prometheus -n monitoring -o jsonpath='{.items[0].spec.ruleSelector}'Fix โ Add the file/glob, reload, or add the label (often release: kube-prometheus-stack).
Prevent โ Lint that every PrometheusRule carries the selector label.
Q97 Grafana-managed alert shows Error state with [sse.dataQueryError] failed to execute query A: ... context deadline exceeded
Intermediate
Error state with [sse.dataQueryError] failed to execute query A: ... context deadline exceededLikely causes โ The alert query is too heavy or the data source is slow; Grafana's evaluation timeout is hit.
Diagnose โ Run the query in Explore with the same time range and check duration.
Fix โ Simplify or back it with a recording rule; set "Error state handling" to Keep last state or Error deliberately rather than Alerting.
Prevent โ Prefer Prometheus-evaluated rules for critical alerts; Grafana alerting depends on Grafana being up.
Q98 Grafana alerts fire as DatasourceNoData all night
Intermediate
DatasourceNoData all nightLikely causes โ The query returns no series during low traffic or after a metric rename; "No data" state is configured to alert.
Diagnose โ Run the query for the night time range in Explore.
Fix โ Make the query return 0 with or vector(0), or set "Alert state if no data" to Normal/OK, and add a separate absent-style alert for real missing data.
Prevent โ Decide no-data behaviour per rule, not by default.
Q99 Alert fires for a cluster that was decommissioned months ago
Beginner
Likely causes โ An absent()/up == 0 rule still references the old cluster, or the old Prometheus still sends heartbeats from a forgotten VM.
Diagnose โ Check generatorURL in the alert to find the sending Prometheus.
Fix โ Remove the rule or shut down the stray Prometheus.
Prevent โ Include cluster decommission in the runbook: remove monitoring, rules, routes.
Q100 Alert storm: Alertmanager memory climbs and the UI becomes unresponsive
Advanced
Likely causes โ A rule produces tens of thousands of alert instances (e.g. per-pod or per-path labels), each a separate alert.
Diagnose โ
alertmanager_alerts
count by (alertname) (ALERTS{alertstate="firing"})Fix โ Aggregate the rule (sum by (service)), silence the offender, and restart if needed.
Prevent โ Set a rule limit: on the group (Prometheus 2.31+) so a rule producing too many alerts fails instead of flooding.
Grafana dashboards and data sources
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q101 Every panel on a dashboard shows No data
Beginner
No dataLikely causes โ The dashboard's data source variable points to the wrong (or a deleted) data source, the time range is wrong, or a template variable resolved to nothing.
Diagnose โ Open one panel โ Query inspector โ see the actual request and response; check the datasource and $variables at the top.
Fix โ Select the correct data source, fix variable queries (e.g. label_values(up, job)), or set the time range to cover data.
Prevent โ Use a ${datasource} variable in shared dashboards instead of hardcoded UIDs.
Q102 Grafana data source test fails with Bad Gateway (HTTP 502)
Beginner
Bad Gateway (HTTP 502)Likely causes โ Grafana's backend cannot reach the URL: wrong host/port, DNS failure from the Grafana pod, NetworkPolicy, or the backend is down.
Diagnose โ
kubectl exec -n monitoring deploy/grafana -- wget -qO- -T 5 http://prometheus-operated:9090/-/ready
kubectl logs -n monitoring deploy/grafana | grep -i 'proxy\|datasource'Fix โ Use the in-cluster DNS name (http://prometheus-operated.monitoring.svc:9090), set access mode to Server (not Browser), and open NetworkPolicy egress.
Prevent โ Provision data sources as code and check them after cluster changes.
Q103 Data source test returns Post "http://prometheus:9090/api/v1/query": dial tcp: lookup prometheus on 10.96.0.10:53: no such host
Beginner
Post "http://prometheus:9090/api/v1/query": dial tcp: lookup prometheus on 10.96.0.10:53: no such hostLikely causes โ The short Service name only resolves in the same namespace; Grafana runs in another namespace.
Diagnose โ kubectl exec deploy/grafana -- nslookup prometheus.monitoring.svc.cluster.local.
Fix โ Use the FQDN http://prometheus.monitoring.svc.cluster.local:9090.
Prevent โ Always use FQDNs in provisioned data sources.
Q104 Grafana shows 504 Gateway Timeout on long-range queries
Advanced
504 Gateway Timeout on long-range queriesLikely causes โ The query outlasts the data source timeout, the Grafana [dataproxy] timeout (default 30s), or an ingress/load balancer idle timeout.
Diagnose โ Query inspector shows request duration; check ingress annotations and Grafana logs.
Fix โ Optimise the query (recording rules), raise the data source Timeout field and [dataproxy] timeout, and the ingress proxy-read-timeout.
Prevent โ Keep heavy long-range views on downsampled data (Thanos/Mimir).
Q105 Grafana behind a reverse proxy shows If you're seeing this Grafana has failed to load its application files
Beginner
If you're seeing this Grafana has failed to load its application filesLikely causes โ Served under a sub-path (/grafana/) without root_url and serve_from_sub_path.
Diagnose โ Browser devtools show 404s for /public/build/*.js.
Fix โ
[server]
root_url = https://ops.example.com/grafana/
serve_from_sub_path = truePrevent โ Set these via Helm grafana.ini values from day one.
Q106 Grafana login loops back to the login page after successful OAuth
Intermediate
Likely causes โ root_url does not match the external URL so the redirect URI/cookies mismatch, or cookies are marked secure on HTTP, or multiple replicas without shared sessions/database.
Diagnose โ Check Grafana logs for oauth errors and the browser's cookie for grafana_session.
Fix โ Set root_url to the exact public URL; match the IdP redirect URI (https://grafana.example.com/login/generic_oauth); use a shared DB (PostgreSQL/MySQL) for multiple replicas.
Prevent โ Never run multiple Grafana replicas on SQLite.
Q107 Grafana pod logs database is locked and dashboards fail to save
Intermediate
database is locked and dashboards fail to saveLikely causes โ SQLite on a network or shared volume, or several replicas pointing at the same SQLite file.
Diagnose โ Check [database] type in config and the replica count.
Fix โ Move to PostgreSQL or MySQL ([database] type = postgres), or scale back to one replica with a local PVC.
Prevent โ Use an external DB for any HA or production Grafana.
Q108 Dashboard variable dropdown is empty
Beginner
Likely causes โ The variable query returns nothing for the selected time range or references a parent variable that is empty; regex filter excludes everything.
Diagnose โ Dashboard settings โ Variables โ Run query / preview of values.
Fix โ Use label_values(kube_pod_info{namespace="$namespace"}, pod), set refresh to "On time range change", and test the regex.
Prevent โ Order variables so parents load before children.
Q109 Panel shows Data outside time range
Beginner
Data outside time rangeLikely causes โ Data exists but not in the selected window, often due to timezone mismatch or a panel-level relative time override.
Diagnose โ Check panel Query options for relative time/time shift and the dashboard timezone.
Fix โ Remove the override or set timezone to the browser/UTC consistently; use "Zoom to data".
Prevent โ Pick UTC for operational dashboards.
Q110 Grafana panel shows Too many datapoints / browser freezes
Intermediate
Too many datapoints / browser freezesLikely causes โ The query returns thousands of series (no aggregation) or a tiny step over a long range.
Diagnose โ Query inspector โ Data shows series count.
Fix โ Aggregate (sum by (service)), use topk, set Max data points and Min interval.
Prevent โ Review new panels for series count before sharing.
Q111 Provisioned dashboards revert after users edit them
Beginner
Likely causes โ File-provisioned dashboards are overwritten from disk on each updateIntervalSeconds; UI changes are not persisted to the file.
Diagnose โ Dashboard shows "Cannot save provisioned dashboard".
Fix โ Edit the JSON in Git, or set allowUiUpdates: true in the provider (changes still lost on restart unless exported).
Prevent โ Treat dashboards as code (Grafonnet, Terraform grafana_dashboard, or Git sync) with a clear workflow.
Q112 Grafana sidecar does not load dashboards from ConfigMaps
Intermediate
Likely causes โ The ConfigMap lacks the label the sidecar watches (grafana_dashboard: "1" by default), it's in a namespace the sidecar doesn't search, or JSON is invalid.
Diagnose โ
kubectl logs -n monitoring deploy/grafana -c grafana-sc-dashboard | tail
kubectl get cm -A -l grafana_dashboard=1Fix โ Add the label, set sidecar.dashboards.searchNamespace: ALL in the Helm values, validate JSON with jq.
Prevent โ CI-validate dashboard JSON and labels.
Q113 Imported dashboard panels show Datasource ${DS_PROMETHEUS} was not found
Beginner
Datasource ${DS_PROMETHEUS} was not foundLikely causes โ The dashboard JSON came from grafana.com with an __inputs placeholder, and it was provisioned from file without resolving it.
Diagnose โ Search the JSON for ${DS_.
Fix โ Replace the placeholder with your data source UID, or convert to a datasource template variable.
Prevent โ Normalise imported dashboards before committing them.
Q114 Loki data source returns Data source connected, but no labels received
Intermediate
Data source connected, but no labels receivedLikely causes โ No logs have been ingested in the queried range, the X-Scope-OrgID tenant header is wrong/missing in multi-tenant Loki, or the URL points at the wrong component.
Diagnose โ
curl -s -H 'X-Scope-OrgID: prod' http://loki-gateway/loki/api/v1/labelsFix โ Add the X-Scope-OrgID custom header in the data source, point to the gateway/query-frontend, and confirm agents are shipping.
Prevent โ Provision tenants explicitly per data source.
Q115 Grafana Tempo data source Trace not found when clicking a trace ID from logs
Intermediate
Trace not found when clicking a trace ID from logsLikely causes โ The derived-field regex captures the wrong string, the trace wasn't sampled, or it is outside the search window.
Diagnose โ Copy the trace ID and search Tempo directly; check the Loki derived field regex (e.g. trace_id=(\w+)).
Fix โ Fix the regex and target data source UID; widen Tempo's search time shift settings.
Prevent โ Log trace IDs in a consistent field (trace_id) across services.
Q116 Grafana CloudWatch data source returns AccessDenied: ... not authorized to perform: cloudwatch:GetMetricData
Intermediate
AccessDenied: ... not authorized to perform: cloudwatch:GetMetricDataLikely causes โ The IAM role used by Grafana (IRSA, instance profile or keys) lacks permissions.
Diagnose โ aws sts get-caller-identity from the Grafana pod; check the role policy.
Fix โ Grant cloudwatch:GetMetricData, cloudwatch:ListMetrics, cloudwatch:DescribeAlarms, logs:StartQuery, logs:GetQueryResults, ec2:DescribeRegions, tag:GetResources.
Prevent โ Use the AWS-documented Grafana policy as a managed policy.
Q117 Grafana memory spikes and the pod is OOMKilled when a big dashboard opens
Advanced
Likely causes โ Server-side expressions or transformations over huge result sets, image rendering, or many concurrent panel queries.
Diagnose โ grafana_ process metrics, logs around the time, and Query inspector sizes per panel.
Fix โ Reduce series per panel, move transformations into PromQL, raise memory limits, run the image renderer as a separate service.
Prevent โ Split mega-dashboards into overview + drill-down.
Q118 Graph shows a flat line at the last value after the service died
Intermediate
Likely causes โ Grafana "Connect null values" set to Always, or the query uses last_over_time/max_over_time with a long window that hides gaps.
Diagnose โ Check panel settings and the raw query output.
Fix โ Set Connect null values to Never or a threshold, and use short windows.
Prevent โ Pair key graphs with up panels.
Q119 Grafana annotations from Prometheus alerts don't appear
Beginner
Likely causes โ The annotation query uses the wrong metric or is disabled.
Diagnose โ Dashboard settings โ Annotations; run ALERTS{alertstate="firing"} in Explore.
Fix โ Add an annotation with data source Prometheus and query ALERTS{alertstate="firing", service="$service"}, with "Series value as timestamp" off.
Prevent โ Add deploy annotations too, so changes and alerts line up.
Q120 Grafana image rendering in alerts fails: Rendering failed: ... no image renderer available
Intermediate
Rendering failed: ... no image renderer availableLikely causes โ The renderer plugin/service is not installed or the URLs are wrong.
Diagnose โ Check [rendering] server_url and callback_url and logs.
Fix โ Deploy grafana-image-renderer as a service; set server_url = http://renderer:8081/render and callback_url = http://grafana:3000/.
Prevent โ Include the renderer in the Helm release (imageRenderer.enabled: true).
Q121 A user sees dashboards but gets Permission denied on Explore
Beginner
Permission denied on ExploreLikely causes โ Viewer role cannot use Explore unless viewers_can_edit is enabled or the user has the Editor role / a data source query permission.
Diagnose โ Check user role in the org and data source permissions.
Fix โ Grant Editor or use RBAC data source query permission (Enterprise/Cloud), or team-based roles.
Prevent โ Map IdP groups to roles in [auth.generic_oauth] role_attribute_path.
Q122 Panels using $__rate_interval show nothing at short time ranges
Intermediate
$__rate_interval show nothing at short time rangesLikely causes โ The data source Scrape interval setting is lower than the real scrape interval, so $__rate_interval becomes too small to hold 2 samples.
Diagnose โ Query inspector shows the expanded interval (e.g. [1m] for a 60s scrape).
Fix โ Set the Prometheus data source Scrape interval to the real value (e.g. 60s), so $__rate_interval = max(4 ร scrape, interval + scrape).
Prevent โ Provision data sources with the correct timeInterval.
Q123 After upgrading Grafana, old Angular panels show Panel plugin not found
Intermediate
Panel plugin not foundLikely causes โ AngularJS support was deprecated and removed in recent Grafana versions; old plugins (e.g. legacy graph, singlestat, worldmap) no longer load.
Diagnose โ Dashboard shows a deprecation warning badge on panels before upgrade.
Fix โ Migrate to core React panels (Time series, Stat, Geomap); Grafana auto-migrates many core ones when you open and save.
Prevent โ Scan for Angular panels before major upgrades.
Q124 Elasticsearch data source in Grafana returns index_not_found_exception
Beginner
index_not_found_exceptionLikely causes โ Index pattern does not match the real index names (logs-* vs filebeat-*) or uses daily pattern syntax wrongly.
Diagnose โ curl -s es:9200/_cat/indices?v | head.
Fix โ Set the index name to the right wildcard (or data stream), and the correct time field (@timestamp).
Prevent โ Standardise index naming via index templates.
Q125 Grafana shows timestamps 5h30m off from the logs
Beginner
Likely causes โ Logs are parsed without timezone (treated as UTC) while the source writes local time (IST), or the dashboard timezone setting differs.
Diagnose โ Compare raw log line time with @timestamp/Loki timestamp.
Fix โ Log in UTC with an explicit offset (ISO 8601), or set the parser's timezone (Fluent Bit Time_Offset, Logstash timezone).
Prevent โ Enforce UTC on servers and in app log formats.
Kubernetes monitoring and the Prometheus Operator
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q126 A new ServiceMonitor is not picked up by the Prometheus Operator
Intermediate
Likely causes โ The ServiceMonitor lacks the label matching serviceMonitorSelector (kube-prometheus-stack: release: <helm-release>), its namespace is not in serviceMonitorNamespaceSelector, or the CRD version differs.
Diagnose โ
kubectl get prometheus -n monitoring -o jsonpath='{.items[0].spec.serviceMonitorSelector}{"\n"}{.items[0].spec.serviceMonitorNamespaceSelector}'
kubectl get servicemonitor -n shop checkout -o yaml | grep -A3 labelsFix โ Add the label (e.g. release: kube-prometheus-stack), or set the Helm values serviceMonitorSelectorNilUsesHelmValues: false so all ServiceMonitors are selected.
Prevent โ Provide a ServiceMonitor template with the right labels to app teams.
Q127 ServiceMonitor is selected but its targets don't appear on /targets
Intermediate
/targetsLikely causes โ spec.selector does not match the Service's labels (not the pod labels), endpoints[].port refers to a port name that the Service doesn't define, or namespaceSelector is missing for a cross-namespace Service.
Diagnose โ
kubectl get svc -n shop checkout --show-labels
kubectl get svc -n shop checkout -o jsonpath='{.spec.ports[*].name}'
kubectl get endpoints -n shop checkoutFix โ Match Service labels, use the named port (port: http-metrics) or targetPort, and add namespaceSelector: { matchNames: [shop] } if needed.
Prevent โ Name metrics ports consistently (metrics).
Q128 ServiceMonitor target appears but Operator logs skipping servicemonitor ... failed to get secret
Advanced
skipping servicemonitor ... failed to get secretLikely causes โ The ServiceMonitor references a basic auth / bearer / TLS Secret that is in a different namespace or missing; the Operator only reads Secrets in the ServiceMonitor's namespace.
Diagnose โ
kubectl logs -n monitoring deploy/prometheus-operator | grep -i 'servicemonitor\|secret'
kubectl get secret -n shopFix โ Create the Secret in the same namespace as the ServiceMonitor and reference it via basicAuth/authorization.credentials.
Prevent โ Keep secrets beside the ServiceMonitor in the app's Helm chart.
Q129 PodMonitor targets show DOWN with connection refused on port 8080 while the app listens on 9090
Beginner
DOWN with connection refused on port 8080 while the app listens on 9090Likely causes โ podMetricsEndpoints[].port names a container port that isn't the metrics port, or the container doesn't declare ports at all.
Diagnose โ kubectl get pod <pod> -o jsonpath='{.spec.containers[*].ports}'.
Fix โ Declare - name: metrics, containerPort: 9090 in the pod spec and use port: metrics.
Prevent โ Lint deployments for a named metrics port.
Q130 PrometheusRule created but rules don't show in Prometheus
Intermediate
Likely causes โ ruleSelector/ruleNamespaceSelector mismatch, or the admission webhook rejected invalid PromQL.
Diagnose โ
kubectl get prometheusrule -A --show-labels | grep myrules
kubectl get cm -n monitoring | grep rulefiles
kubectl logs -n monitoring deploy/prometheus-operator | grep -i ruleFix โ Add the selector label, fix the expression (promtool check rules on the extracted spec).
Prevent โ Keep the Operator's admission webhook enabled so bad rules fail at kubectl apply.
Q131 KubeletDown / TargetDown alerts fire for kube-scheduler and kube-controller-manager on EKS/GKE
Beginner
KubeletDown / TargetDown alerts fire for kube-scheduler and kube-controller-manager on EKS/GKELikely causes โ Managed control planes don't expose those components for scraping; kube-prometheus-stack defaults try anyway.
Diagnose โ /targets shows kube-scheduler and kube-controller-manager jobs with no endpoints or DOWN.
Fix โ Disable in Helm values: kubeScheduler.enabled: false, kubeControllerManager.enabled: false, kubeEtcd.enabled: false, kubeProxy.enabled as appropriate.
Prevent โ Keep per-platform values files.
Q132 On kubeadm clusters, kube-controller-manager and kube-scheduler targets are DOWN with connection refused
Intermediate
kube-controller-manager and kube-scheduler targets are DOWN with connection refusedLikely causes โ They bind to 127.0.0.1 by default (--bind-address=127.0.0.1), so Prometheus can't reach them on the node IP.
Diagnose โ grep bind-address /etc/kubernetes/manifests/kube-scheduler.yaml.
Fix โ Set --bind-address=0.0.0.0 in the static pod manifests (ports 10259 and 10257, HTTPS), restricting access with firewall rules. Same for etcd metrics with --listen-metrics-urls=http://0.0.0.0:2381.
Prevent โ Bake these flags into the cluster bootstrap.
Q133 kube-proxy target shows connection refused on port 10249
Beginner
kube-proxy target shows connection refused on port 10249Likely causes โ kube-proxy's metricsBindAddress defaults to 127.0.0.1:10249.
Diagnose โ kubectl -n kube-system get cm kube-proxy -o yaml | grep metricsBindAddress.
Fix โ Set metricsBindAddress: 0.0.0.0:10249 and restart the kube-proxy DaemonSet.
Prevent โ Include it in cluster config.
Q134 kube-state-metrics series are missing for a new CRD-based resource
Intermediate
Likely causes โ kube-state-metrics only exposes built-in resources by default; custom resources need --custom-resource-state-config.
Diagnose โ curl ksm:8080/metrics | grep -i <crd> returns nothing.
Fix โ Provide a CustomResourceStateMetrics config describing which fields to expose, and grant RBAC to list/watch the CRD.
Prevent โ Prefer the operator's own metrics endpoint for its CRDs where available.
Q135 kube-state-metrics pod OOMKilled in a large cluster
Advanced
Likely causes โ Thousands of objects ร all resources ร all labels (--metric-labels-allowlist=pods=[*]) in one replica.
Diagnose โ kubectl top pod -n monitoring -l app.kubernetes.io/name=kube-state-metrics; check series count by job="kube-state-metrics".
Fix โ Restrict --resources, narrow --metric-labels-allowlist, and shard horizontally (--shard/--total-shards, or StatefulSet auto-sharding).
Prevent โ Track KSM series per resource type.
Q136 Pods in a namespace have no cAdvisor metrics but node metrics are fine
Intermediate
Likely causes โ A metric_relabel_configs drop on the cAdvisor job, or the container runtime changed and labels (container, pod) are empty.
Diagnose โ
count by (namespace) (container_cpu_usage_seconds_total)Curl kubectl get --raw /api/v1/nodes/<node>/proxy/metrics/cadvisor | grep <ns>.
Fix โ Fix relabel rules; upgrade kubelet/containerd if labels are empty.
Prevent โ Alert when a namespace with pods has zero container metrics.
Q137 kubectl top pods returns error: Metrics API not available
Beginner
kubectl top pods returns error: Metrics API not availableLikely causes โ metrics-server is not installed or its APIService is unavailable (often TLS to kubelets).
Diagnose โ
kubectl get apiservice v1beta1.metrics.k8s.io
kubectl logs -n kube-system deploy/metrics-serverCommon log: x509: cannot validate certificate ... doesn't contain any IP SANs.
Fix โ Install metrics-server; fix kubelet serving certs (enable serverTLSBootstrap), or as a lab-only workaround add --kubelet-insecure-tls.
Prevent โ Remember HPA depends on it; alert on the APIService availability.
Q138 HPA shows unknown targets: failed to get cpu utilization: missing request for cpu
Beginner
unknown targets: failed to get cpu utilization: missing request for cpuLikely causes โ CPU utilisation is computed as a percentage of requests; a container without resources.requests.cpu makes it impossible.
Diagnose โ kubectl describe hpa checkout shows the event.
Fix โ Set CPU requests on every container in the pod (including sidecars).
Prevent โ Enforce requests with LimitRange or a policy engine (Kyverno/Gatekeeper).
Q139 HPA on a custom metric reports unable to get metric http_requests_per_second: no metrics returned from custom metrics API
Advanced
unable to get metric http_requests_per_second: no metrics returned from custom metrics APILikely causes โ prometheus-adapter rules don't expose the metric, the query returns no series for that namespace/pod, or the APIService v1beta1.custom.metrics.k8s.io is down.
Diagnose โ
kubectl get apiservice v1beta1.custom.metrics.k8s.io
kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1/namespaces/shop/pods/*/http_requests_per_second" | jqFix โ Add an adapter rule with seriesQuery, resources.overrides mapping namespace/pod labels, and metricsQuery; or use KEDA's Prometheus scaler.
Prevent โ Test custom metric queries before wiring them to HPAs.
Q140 Prometheus Operator logs sync "monitoring/k8s" failed: ... the server could not find the requested resource after upgrade
Advanced
sync "monitoring/k8s" failed: ... the server could not find the requested resource after upgradeLikely causes โ CRDs are older than the Operator version; Helm does not upgrade CRDs automatically.
Diagnose โ kubectl get crd prometheuses.monitoring.coreos.com -o jsonpath='{.metadata.annotations}' and compare with the Operator release.
Fix โ Apply the matching CRDs (server-side to avoid size limits):
kubectl apply --server-side -f https://github.com/prometheus-operator/prometheus-operator/releases/download/<version>/stripped-down-crds.yamlPrevent โ Make CRD upgrades an explicit step in your upgrade runbook.
Q141 kubectl apply of the Prometheus CRDs fails with metadata.annotations: Too long: must have at most 262144 bytes
Intermediate
kubectl apply of the Prometheus CRDs fails with metadata.annotations: Too long: must have at most 262144 bytesLikely causes โ Client-side apply stores the full object in the last-applied-configuration annotation; the CRDs are too big.
Diagnose โ The error text is clear.
Fix โ Use kubectl apply --server-side --force-conflicts -f crds/ or kubectl replace/create.
Prevent โ Use server-side apply for large CRDs in all pipelines.
Q142 Prometheus StatefulSet pod stuck Pending with 0/6 nodes are available: 6 node(s) had volume node affinity conflict
Intermediate
Pending with 0/6 nodes are available: 6 node(s) had volume node affinity conflictLikely causes โ The EBS PV lives in one AZ, and there is no schedulable node in that AZ (node group scaled in or moved).
Diagnose โ
kubectl get pv $(kubectl get pvc -n monitoring prometheus-k8s-db-prometheus-k8s-0 -o jsonpath='{.spec.volumeName}') -o jsonpath='{.spec.nodeAffinity}'
kubectl get nodes -L topology.kubernetes.io/zoneFix โ Add capacity in that AZ, or restore the data into a new volume in another AZ.
Prevent โ Use volumeBindingMode: WaitForFirstConsumer and keep node groups spread across all AZs.
Q143 KubePodCrashLooping alert fires but the pod is in Completed state
Beginner
KubePodCrashLooping alert fires but the pod is in Completed stateLikely causes โ A Job/CronJob pod with restartPolicy: OnFailure retried and the alert expression counts container restarts without excluding Jobs.
Diagnose โ kube_pod_owner{owner_kind="Job"} for the pod.
Fix โ Exclude Jobs or alert on kube_job_failed instead.
Prevent โ Tune default kube-prometheus rules for your workload mix.
Q144 CPUThrottlingHigh fires for many pods even though node CPU is low
Intermediate
CPUThrottlingHigh fires for many pods even though node CPU is lowLikely causes โ CPU limits are low relative to bursty usage; CFS quota throttles per 100ms period regardless of node idle capacity.
Diagnose โ
sum by (pod) (rate(container_cpu_cfs_throttled_periods_total[5m]))
/ sum by (pod) (rate(container_cpu_cfs_periods_total[5m]))Fix โ Raise or remove CPU limits for latency-sensitive services (keep requests).
Prevent โ Raise the alert threshold or route it as a ticket, not a page.
Q145 KubeMemoryOvercommit and KubeCPUOvercommit fire after adding a namespace
Beginner
KubeMemoryOvercommit and KubeCPUOvercommit fire after adding a namespaceLikely causes โ The sum of requests exceeds what the cluster can absorb after losing a node (N-1).
Diagnose โ Compare sum(kube_pod_container_resource_requests{resource="cpu"}) with allocatable minus the largest node.
Fix โ Add nodes, right-size requests, or let the autoscaler add capacity.
Prevent โ Review requests with VPA recommendations.
Q146 node-exporter DaemonSet does not run on tainted nodes
Beginner
Likely causes โ No toleration for the taints (GPU, infra, control-plane).
Diagnose โ kubectl get ds -n monitoring node-exporter shows DESIRED < node count; kubectl describe node for taints.
Fix โ Add tolerations: [{operator: Exists}] to the DaemonSet.
Prevent โ Alert when DaemonSet desired != node count.
Q147 Prometheus pod logs forbidden: User "system:serviceaccount:monitoring:prometheus-k8s" cannot list resource "endpoints" in API group "" in the namespace "shop"
Intermediate
forbidden: User "system:serviceaccount:monitoring:prometheus-k8s" cannot list resource "endpoints" in API group "" in the namespace "shop"Likely causes โ The Operator namespaced RBAC doesn't include the new namespace (kube-prometheus creates Roles per listed namespace).
Diagnose โ
kubectl auth can-i list endpoints -n shop --as=system:serviceaccount:monitoring:prometheus-k8sFix โ Add a Role/RoleBinding in shop, or use a ClusterRole for cluster-wide discovery.
Prevent โ Include the monitoring Role in namespace onboarding.
Q148 Two Prometheus instances (kube-prometheus and a team's own) both scrape the same targets and double cost
Advanced
Likely causes โ Both select all ServiceMonitors (empty selectors).
Diagnose โ Compare /targets across instances; check each Prometheus CR's selectors.
Fix โ Give each Prometheus a distinct serviceMonitorSelector (e.g. prometheus: platform vs prometheus: team-a), or use namespace selectors.
Prevent โ One label convention for ownership of ServiceMonitors.
Q149 Operator-generated config fails reload: relabel configuration for replace action requires 'target_label' value
Advanced
relabel configuration for replace action requires 'target_label' valueLikely causes โ A ServiceMonitor relabelings/metricRelabelings entry is missing targetLabel, breaking the whole generated config.
Diagnose โ
kubectl logs prometheus-k8s-0 -n monitoring -c config-reloader
kubectl logs prometheus-k8s-0 -n monitoring -c prometheus | grep -i 'error loading config'Fix โ Add targetLabel; find the offending ServiceMonitor from the job name in the error.
Prevent โ Keep the admission webhook on; newer Operator versions validate relabelings and reject the resource.
Q150 Metrics from short-lived Kubernetes Job pods never appear
Intermediate
Likely causes โ The pod finishes before the next scrape (30s interval), or the PodMonitor is selected but the pod is gone by discovery time.
Diagnose โ Job duration vs scrape interval.
Fix โ Push final metrics to Pushgateway (or OTel collector) at job end, or have the job stay alive for one scrape window.
Prevent โ Track job success via kube-state-metrics (kube_job_status_succeeded, kube_job_status_failed) instead of app metrics.
Logging: Loki, Fluent Bit and Elasticsearch
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q151 Promtail/Alloy logs server returned HTTP status 400 Bad Request (400): entry with timestamp ... ignored, reason: 'entry out of order' for stream
Intermediate
server returned HTTP status 400 Bad Request (400): entry with timestamp ... ignored, reason: 'entry out of order' for streamLikely causes โ Older Loki (before 2.4) or unordered_writes: false rejects entries older than the latest one in the same stream; two agents ship the same file with the same labels; or a pipeline parses timestamps from the line that go backwards.
Diagnose โ
kubectl logs -n logging ds/promtail | grep -c 'out of order'
logcli series '{app="checkout"}' --since=1hCheck whether two pods/agents produce identical label sets.
Fix โ Upgrade Loki and enable limits_config.unordered_writes: true (default since 2.4), add a unique label per source (pod, instance), and drop the timestamp stage if app timestamps are unreliable.
Prevent โ One writer per stream; monitor loki_discarded_samples_total{reason="out_of_order"}.
Q152 Agents log server returned HTTP status 429 Too Many Requests (429): Ingestion rate limit exceeded for user fake (limit: 4194304 bytes/sec)
Intermediate
server returned HTTP status 429 Too Many Requests (429): Ingestion rate limit exceeded for user fake (limit: 4194304 bytes/sec)Likely causes โ The tenant exceeds ingestion_rate_mb / ingestion_burst_size_mb (defaults are low: 4 MB/s, 6 MB burst), often after a noisy service starts debug logging.
Diagnose โ
sum by (tenant, reason) (rate(loki_discarded_samples_total[5m]))
topk(10, sum by (app) (rate(loki_distributor_bytes_received_total[5m])))Fix โ Find and quiet the noisy source (drop debug lines in the agent), then raise per-tenant limits:
limits_config:
ingestion_rate_mb: 20
ingestion_burst_size_mb: 40
per_stream_rate_limit: 5MBPrevent โ Alert on discarded samples and set per-app log budgets.
Q153 Loki rejects pushes with Per stream rate limit exceeded (limit: 3MB/sec) while attempting to ingest for stream
Advanced
Per stream rate limit exceeded (limit: 3MB/sec) while attempting to ingest for streamLikely causes โ One stream (one label set) carries too much volume, e.g. all pods of a deployment collapsed into one stream because pod was dropped.
Diagnose โ logcli series --analyze-labels '{namespace="shop"}' and per-stream volume in the Loki dashboards.
Fix โ Split streams by a bounded label (pod or container), or raise per_stream_rate_limit/per_stream_rate_limit_burst.
Prevent โ Design labels for ~low thousands of streams per tenant, each modest in volume.
Q154 Loki logs maximum active stream limit exceeded, reduce the number of active streams
Advanced
maximum active stream limit exceeded, reduce the number of active streamsLikely causes โ High-cardinality labels in logs: trace_id, user_id, request_id, or JSON-extracted fields promoted to labels.
Diagnose โ
logcli series --analyze-labels '{}' --since=1hLook for labels with thousands of unique values.
Fix โ Remove those labels from the agent pipeline (keep them in the line or as structured metadata in Loki 3.x) and filter at query time with | json | trace_id="...".
Prevent โ Allowlist labels in agent config; max_global_streams_per_user as a guardrail.
Q155 LogQL query fails with max entries limit per query exceeded, limit > max_entries_limit (10000 > 5000)
Beginner
max entries limit per query exceeded, limit > max_entries_limit (10000 > 5000)Likely causes โ The Grafana line limit or logcli --limit is above Loki's max_entries_limit_per_query.
Diagnose โ Check Grafana data source "Maximum lines" and Loki limits_config.
Fix โ Lower the client limit, narrow the query, or raise max_entries_limit_per_query.
Prevent โ Use metric queries (count_over_time, rate) for overviews instead of pulling raw lines.
Q156 LogQL returns too many outstanding requests in Grafana
Advanced
too many outstanding requests in GrafanaLikely causes โ The query-frontend/scheduler queue is full: big time ranges split into many sub-queries with too few queriers.
Diagnose โ cortex_query_scheduler_queue_length / loki_query_scheduler_queue_length, querier CPU.
Fix โ Scale queriers, raise max_outstanding_requests_per_tenant, narrow label selectors (stream selector first, line filters before parsers).
Prevent โ Put recording rules (Loki ruler) behind dashboards that query weeks of logs.
Q157 Logs appear in Loki for most pods but not for one namespace
Beginner
Likely causes โ A relabel/drop rule in the agent excludes it, the pods log to files instead of stdout, or the agent pod on those nodes is not running.
Diagnose โ
kubectl get ds -n logging
kubectl logs -n logging <agent-pod-on-that-node> | grep -i errorCheck agent targets UI (Promtail :9080/targets, Alloy UI).
Fix โ Fix drop rules, log to stdout/stderr, add tolerations for tainted nodes.
Prevent โ Alert on agent DaemonSet coverage and on namespaces with zero log volume.
Q158 Loki compactor logs failed to upload ... AccessDenied and retention stops working
Intermediate
failed to upload ... AccessDenied and retention stops workingLikely causes โ The IAM role (IRSA) lacks s3:DeleteObject/s3:PutObject, or retention isn't enabled on the compactor.
Diagnose โ Compactor logs; aws s3 ls s3://loki-chunks/index/ to see if index files update.
Fix โ Grant s3:ListBucket, s3:GetObject, s3:PutObject, s3:DeleteObject; set compactor.retention_enabled: true with delete_request_store: s3 and limits_config.retention_period: 744h.
Prevent โ Alert on loki_compactor_last_successful_run_timestamp_seconds staleness.
Q159 Fluent Bit logs [warn] [input] tail.0 paused (mem buf overlimit) and logs go missing
Intermediate
[warn] [input] tail.0 paused (mem buf overlimit) and logs go missingLikely causes โ Mem_Buf_Limit is reached because the output is slower than input (backpressure); while paused, new lines are not read and rotated files can be lost.
Diagnose โ
curl -s http://127.0.0.1:2020/api/v1/metrics | jqCheck fluentbit_input_paused, output retries and errors.
Fix โ Enable filesystem buffering so data spills to disk instead of pausing:
[SERVICE]
storage.path /var/fluent-bit/state/flb-storage/
[INPUT]
Name tail
storage.type filesystemFix the slow output (scale Elasticsearch/Loki, increase Workers).
Prevent โ Alert on paused inputs and on fluentbit_output_dropped_records_total.
Q160 Fluent Bit logs [error] [output:es:es.0] HTTP status=400 URI=/_bulk with mapper_parsing_exception
Advanced
[error] [output:es:es.0] HTTP status=400 URI=/_bulk with mapper_parsing_exceptionLikely causes โ Mapping conflict: one app sends status as a string, another as an object or number, and the index mapping rejects the document. Kubernetes labels with dots (app.kubernetes.io/name) also clash with object mappings.
Diagnose โ Set Trace_Error On in the es output to print the ES response; check GET logs-*/_mapping/field/status.
Fix โ Use Replace_Dots On in the es output, rename conflicting fields with a modify filter, or route the app to its own index.
Prevent โ Index templates with explicit mappings and dynamic: false for unknown fields.
Q161 Fluent Bit logs [warn] [engine] failed to flush chunk ... retry in 10 seconds repeatedly, then chunk cannot be retried
Intermediate
[warn] [engine] failed to flush chunk ... retry in 10 seconds repeatedly, then chunk cannot be retriedLikely causes โ The destination is unreachable or rejecting; after Retry_Limit attempts the chunk is discarded.
Diagnose โ Output errors in logs, fluentbit_output_retries_failed_total, connectivity test from the node.
Fix โ Fix the destination; set Retry_Limit no_limits (or False) for critical outputs with filesystem buffering and storage.total_limit_size to cap disk.
Prevent โ Alert on rate(fluentbit_output_retries_failed_total[5m]) > 0.
Q162 Kubernetes metadata is missing from Fluent Bit records (no kubernetes.pod_name)
Beginner
kubernetes.pod_name)Likely causes โ Kube_Tag_Prefix doesn't match the tail Tag, the ServiceAccount can't read pods, or the API server is unreachable.
Diagnose โ Fluent Bit logs show [filter:kubernetes] ... could not get meta for POD or 403.
Fix โ Use Tag kube.* on the tail input with Kube_Tag_Prefix kube.var.log.containers., grant get/list/watch on pods and namespaces, and consider Use_Kubelet On to reduce API load.
Prevent โ Ship the official Helm chart config and test after edits.
Q163 Multi-line Java stack traces arrive in Loki/ES as one event per line
Intermediate
Likely causes โ No multiline parser is configured, or the CRI parser runs after multiline grouping.
Diagnose โ Search for lines starting with \tat stored as separate entries.
Fix โ In Fluent Bit:
[INPUT]
Name tail
multiline.parser cri, javaIn Alloy/Promtail use a multiline stage with firstline: '^\d{4}-\d{2}-\d{2}'.
Prevent โ Better: log JSON in the app so stack traces are one field.
Q164 Fluent Bit CPU spikes and logs [warn] [input:tail:tail.0] file=... has been rotated thousands of times
Advanced
[warn] [input:tail:tail.0] file=... has been rotated thousands of timesLikely causes โ Extremely chatty containers rotate their log every few seconds (kubelet containerLogMaxSize small), plus regex parsers on every line.
Diagnose โ Find the noisy pods: du -sh /var/log/pods/* | sort -h | tail.
Fix โ Fix the noisy app, raise containerLogMaxSize, use Refresh_Interval, Buffer_Max_Size sensibly, and prefer JSON parser over regex.
Prevent โ Per-namespace log volume dashboards and quotas.
Q165 Elasticsearch cluster health is red
Intermediate
redLikely causes โ At least one primary shard is unassigned: node lost with no replica, disk watermark reached, or corrupted shard.
Diagnose โ
curl -s es:9200/_cluster/health?pretty
curl -s 'es:9200/_cat/shards?v&h=index,shard,prirep,state,unassigned.reason' | grep UNASSIGNED
curl -s es:9200/_cluster/allocation/explain?prettyFix โ Act on the explain reason: bring back the node, free disk, or POST _cluster/reroute?retry_failed=true. As a last resort for lost primaries, allocate_empty_primary (data loss) or restore from snapshot.
Prevent โ At least 1 replica, snapshot lifecycle policies, disk alerts.
Q166 Elasticsearch logs flood stage disk watermark [95%] exceeded ... all indices on this node will be marked read-only and writes fail with FORBIDDEN/12/index read-only / allow delete (api)
Intermediate
flood stage disk watermark [95%] exceeded ... all indices on this node will be marked read-only and writes fail with FORBIDDEN/12/index read-only / allow delete (api)Likely causes โ Disk on a data node passed the flood-stage watermark; ES set index.blocks.read_only_allow_delete on its indices.
Diagnose โ
curl -s 'es:9200/_cat/allocation?v'
curl -s 'es:9200/_all/_settings/index.blocks*?pretty' | grep -B3 trueFix โ Free space (delete old indices, add nodes or disk). Since 7.4 the block is removed automatically once usage drops below the high watermark; on older versions:
curl -XPUT es:9200/_all/_settings -H 'Content-Type: application/json' \
-d '{"index.blocks.read_only_allow_delete": null}'Prevent โ ILM delete phase and alerts at 75% disk.
Q167 Elasticsearch cluster is yellow on a single-node setup
Beginner
yellow on a single-node setupLikely causes โ Replicas can't be placed on the same node as their primary, so every index with number_of_replicas: 1 stays yellow.
Diagnose โ _cat/shards shows replicas UNASSIGNED with reason INDEX_CREATED.
Fix โ For a single-node lab: PUT _all/_settings {"index.number_of_replicas": 0} and set it in the index template. In production, add nodes.
Prevent โ Template replicas per environment.
Q168 Elasticsearch shows low disk watermark [85%] exceeded ... replicas will not be assigned to this node
Beginner
low disk watermark [85%] exceeded ... replicas will not be assigned to this nodeLikely causes โ The node is above 85% disk; ES stops allocating new shards to it.
Diagnose โ _cat/allocation?v per node disk.
Fix โ Delete or shrink old indices, add capacity, rebalance. Adjust cluster.routing.allocation.disk.watermark.* only with care.
Prevent โ ILM rollover by size (max_primary_shard_size: 50gb) and delete after N days.
Q169 Bulk indexing fails with es_rejected_execution_exception ... rejected execution ... queue capacity
Advanced
es_rejected_execution_exception ... rejected execution ... queue capacityLikely causes โ The write thread pool queue is full; the cluster can't keep up (hot shards, too many small shards, slow disks).
Diagnose โ
curl -s 'es:9200/_cat/thread_pool/write?v&h=node_name,active,queue,rejected'
curl -s 'es:9200/_cat/shards?v&s=store:desc' | headFix โ Let clients back off and retry, reduce shard count, increase refresh_interval to 30s on log indices, scale hot nodes.
Prevent โ Size shards to 10โ50 GB and watch the rejected counter.
Q170 Elasticsearch logs this action would add [2] shards, but this cluster currently has [1000]/[1000] maximum normal shards open
Intermediate
this action would add [2] shards, but this cluster currently has [1000]/[1000] maximum normal shards openLikely causes โ Daily indices per app with default shards exceeded cluster.max_shards_per_node (1000 per non-frozen data node).
Diagnose โ _cat/indices?v&s=index and _cluster/stats shard count.
Fix โ Delete or shrink old indices, merge per-app indices into data streams with ILM rollover by size.
Prevent โ Fewer, bigger shards; do not raise the limit as a fix.
Q171 Kibana shows Kibana server is not ready yet
Beginner
Kibana server is not ready yetLikely causes โ Kibana can't connect to Elasticsearch (wrong URL, credentials, TLS), versions mismatch, or a saved-objects migration is stuck.
Diagnose โ kubectl logs deploy/kibana / journalctl -u kibana; look for Unable to retrieve version information or migration errors.
Fix โ Correct elasticsearch.hosts, use a service account token, match versions; for stuck migrations follow the error (often a red .kibana index).
Prevent โ Upgrade ES before Kibana and snapshot before upgrades.
Q172 Logstash pipeline logs Could not index event to Elasticsearch ... "type"=>"illegal_argument_exception", "reason"=>"Limit of total fields [1000] has been exceeded"
Advanced
Could not index event to Elasticsearch ... "type"=>"illegal_argument_exception", "reason"=>"Limit of total fields [1000] has been exceeded"Likely causes โ Dynamic mapping creates a field per unique JSON key (e.g. keys containing IDs), hitting index.mapping.total_fields.limit.
Diagnose โ GET logs-*/_mapping and count fields; find the app sending dynamic keys.
Fix โ Fix the producer, map the dynamic object as flattened, or set dynamic: false on that object.
Prevent โ Index templates with explicit mappings; avoid raising the limit blindly.
Q173 Logs in Elasticsearch are 20 minutes behind real time
Advanced
Likely causes โ Queue backlog somewhere: agent buffer, Kafka consumer lag, Logstash pipeline workers saturated, or ES indexing slow.
Diagnose โ Compare @timestamp vs ingest time (add an ingest pipeline set of event.ingested); check Kafka lag and _nodes/stats/indices/indexing.
Fix โ Scale the bottleneck stage (pipeline workers, partitions/consumers, ES hot nodes), batch larger bulk requests.
Prevent โ Alert on end-to-end lag (event.ingested - @timestamp).
Q174 Alloy logs error sending batch, will retry ... status=401 ... no org id
Beginner
error sending batch, will retry ... status=401 ... no org idLikely causes โ Loki runs with auth_enabled: true and the agent sends no tenant ID.
Diagnose โ Check the loki.write endpoint config for tenant_id.
Fix โ
loki.write "default" {
endpoint {
url = "http://loki-gateway/loki/api/v1/push"
tenant_id = "prod"
}
}Prevent โ Template tenant IDs per cluster.
Q175 Loki queriers log context canceled and queries over 7 days time out
Advanced
context canceled and queries over 7 days time outLikely causes โ Broad stream selectors ({namespace=~".+"}) force reading huge chunk volumes; no query splitting or caching; query_timeout short.
Diagnose โ Query stats in Grafana (bytes processed) and querier logs.
Fix โ Narrow the selector, put line filters (|= "error") before parsers, enable split_queries_by_interval: 1h, results cache and chunks cache (memcached), raise query_timeout modestly.
Prevent โ Teach teams the LogQL order: stream selector โ line filter โ parser โ label filter.
Tracing, OpenTelemetry and CloudWatch
๐ฅ Learn this hands-on with DevOps Shack โ YouTube @devopsshack ยท Hindi @shackverse ยท Courses at devopsshack.com
Q176 Traces show only the frontend span; downstream services start new traces
Intermediate
Likely causes โ Broken context propagation: the traceparent header isn't forwarded (custom HTTP client, message queue, async thread pool), or services use different propagators (W3C vs B3).
Diagnose โ Log incoming headers in the downstream service, or curl -v through the chain; check OTEL_PROPAGATORS on each service.
Fix โ Use instrumented clients (auto-instrumentation), set OTEL_PROPAGATORS=tracecontext,baggage (add b3 where legacy services need it), inject/extract context manually for queues (message headers).
Prevent โ A contract test that asserts trace IDs are continuous across services.
Q177 Traces break at the API gateway / ingress controller
Intermediate
Likely causes โ The ingress strips or regenerates traceparent, or doesn't participate in tracing.
Diagnose โ Compare traceparent before and after the ingress with request logs.
Fix โ Enable OpenTelemetry in the ingress (ingress-nginx enable-opentelemetry: "true" with otlp-collector-host), or configure it to pass headers through untouched.
Prevent โ Include proxies, gateways and service meshes in the propagation design.
Q178 No traces at all arrive; the app logs Failed to export spans. The request could not be executed. Full error message: Failed to connect to localhost/127.0.0.1:4317
Beginner
Failed to export spans. The request could not be executed. Full error message: Failed to connect to localhost/127.0.0.1:4317Likely causes โ The SDK defaults to localhost:4317 but the collector runs elsewhere (DaemonSet on the node, or a Service).
Diagnose โ Check OTEL_EXPORTER_OTLP_ENDPOINT and that the collector listens: kubectl get svc -n observability.
Fix โ Set OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector.observability:4317 (gRPC) or :4318 with OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf. For a node agent use the downward API status.hostIP.
Prevent โ Inject OTel env vars via the OpenTelemetry Operator Instrumentation CR.
Q179 SDK error Unimplemented / 404 Not Found when exporting to the collector
Intermediate
Unimplemented / 404 Not Found when exporting to the collectorLikely causes โ Protocol/port mismatch: sending gRPC to the HTTP port 4318, or HTTP to 4317, or the HTTP path missing /v1/traces when setting a signal-specific endpoint.
Diagnose โ Compare OTEL_EXPORTER_OTLP_PROTOCOL with the port.
Fix โ gRPC โ 4317; http/protobuf โ 4318. With OTEL_EXPORTER_OTLP_TRACES_ENDPOINT include the full path http://collector:4318/v1/traces.
Prevent โ One documented default for all services.
Q180 OTel collector logs Exporting failed. Will retry the request after interval. {"kind": "exporter", "data_type": "traces", "name": "otlp", "error": "rpc error: code = Unavailable desc = connection error"}
Intermediate
Exporting failed. Will retry the request after interval. {"kind": "exporter", "data_type": "traces", "name": "otlp", "error": "rpc error: code = Unavailable desc = connection error"}Likely causes โ The backend (Tempo, Jaeger, vendor) is down or unreachable, TLS mismatch (backend expects plaintext or vice versa), or DNS.
Diagnose โ
kubectl logs -n observability deploy/otel-collector | grep -i export
kubectl exec -n observability deploy/otel-collector -- nc -zv tempo-distributor 4317Fix โ Fix endpoint/port; for plaintext in-cluster backends set tls: { insecure: true } on the exporter; otherwise provide ca_file.
Prevent โ Alert on otelcol_exporter_send_failed_spans and queue size.
Q181 Collector logs Dropping data because sending_queue is full
Advanced
Dropping data because sending_queue is fullLikely causes โ The exporter can't keep up (slow backend, rate limiting), so the in-memory queue overflows and data is dropped.
Diagnose โ
otelcol_exporter_queue_size / otelcol_exporter_queue_capacity
rate(otelcol_exporter_enqueue_failed_spans[5m])Fix โ Fix backend throughput, increase sending_queue.num_consumers and queue_size, enable persistent queue with file_storage, scale collectors horizontally, and sample.
Prevent โ Alert at 70% queue utilisation.
Q182 Collector pod is OOMKilled under load
Intermediate
Likely causes โ No memory_limiter processor, large batches, or tail sampling holding many traces in memory.
Diagnose โ kubectl describe pod (OOMKilled), otelcol_process_memory_rss.
Fix โ Put memory_limiter first in every pipeline:
processors:
memory_limiter:
check_interval: 1s
limit_percentage: 80
spike_limit_percentage: 20
batch: {}
service:
pipelines:
traces:
processors: [memory_limiter, batch]Set GOMEMLIMIT to ~80% of the container limit.
Prevent โ Load-test collectors and alert on refused spans.
Q183 Collector fails to start: error decoding 'exporters': unknown type: "loki"
Intermediate
error decoding 'exporters': unknown type: "loki"Likely causes โ The component isn't included in the distribution (core vs contrib), or it was removed/deprecated (the loki exporter was replaced by sending OTLP to Loki 3.x).
Diagnose โ otelcol-contrib components lists available components.
Fix โ Use the contrib image (otel/opentelemetry-collector-contrib), or switch to the supported path (otlphttp exporter to Loki's /otlp endpoint).
Prevent โ Pin collector versions and read changelogs; build a custom distro with ocb for exactly what you need.
Q184 Collector config loads but pipeline silently does nothing
Beginner
Likely causes โ Components are defined but not referenced in service.pipelines, so they are never started.
Diagnose โ Startup logs list started components; otelcol validate --config=config.yaml.
Fix โ Add receivers, processors and exporters to the pipeline under service.pipelines.traces/metrics/logs.
Prevent โ Validate configs in CI with otelcol validate.
Q185 Collector prometheusremotewrite exporter logs Permanent error: ... 400 Bad Request: out of order sample
Advanced
prometheusremotewrite exporter logs Permanent error: ... 400 Bad Request: out of order sampleLikely causes โ Multiple collector replicas send the same series (e.g. same prometheus receiver scrape config on every replica), or batching reorders samples.
Diagnose โ Check whether series labels identify the collector replica; count collector pods running the scrape.
Fix โ Shard scraping with the Target Allocator (OTel Operator) or run scrape receivers as a single StatefulSet; add a unique collector resource attribute; enable out-of-order on the backend if needed.
Prevent โ Treat scraping in collectors like Prometheus: one scraper per target.
Q186 Traces exist but spans have service.name=unknown_service:java
Beginner
service.name=unknown_service:javaLikely causes โ OTEL_SERVICE_NAME or service.name resource attribute not set.
Diagnose โ Inspect a span's resource attributes in Tempo/Jaeger.
Fix โ Set OTEL_SERVICE_NAME=checkout and OTEL_RESOURCE_ATTRIBUTES=deployment.environment=prod,service.version=1.4.2.
Prevent โ Inject via the OTel Operator or Helm templates; enforce with a collector resource processor default.
Q187 Only ~1% of traces show up, and the error trace you need is missing
Intermediate
Likely causes โ Head sampling (OTEL_TRACES_SAMPLER=parentbased_traceidratio, OTEL_TRACES_SAMPLER_ARG=0.01) decides before the outcome is known.
Diagnose โ Check sampler env vars and collector processors.
Fix โ Use tail sampling in a collector tier: keep all errors and slow traces, sample the rest:
tail_sampling:
policies:
- { name: errors, type: status_code, status_code: { status_codes: [ERROR] } }
- { name: slow, type: latency, latency: { threshold_ms: 1000 } }
- { name: rest, type: probabilistic, probabilistic: { sampling_percentage: 5 } }Route all spans of a trace to the same collector with the loadbalancing exporter (routing_key: traceID).
Prevent โ Document sampling so engineers know what is kept.
Q188 Tail sampling keeps partial traces with missing spans
Advanced
Likely causes โ Spans of one trace land on different collector replicas, each deciding independently; or decision_wait is shorter than the trace duration.
Diagnose โ Compare span counts for one trace across collectors; check otelcol_processor_tail_sampling_sampling_late_span_age.
Fix โ Two-tier setup: agents โ loadbalancing exporter by trace ID โ sampling collectors. Raise decision_wait (e.g. 30s) and num_traces to fit memory.
Prevent โ Size sampling tier for peak spans/sec ร decision_wait.
Q189 Async message consumers (Kafka/SQS) appear as separate, unlinked traces
Intermediate
Likely causes โ Context isn't injected into message headers/attributes, or the consumer doesn't extract it.
Diagnose โ Inspect a message's headers for traceparent.
Fix โ Use instrumented Kafka/SQS clients, or inject with the propagator API on produce and extract on consume; for batches, use span links instead of parent-child.
Prevent โ Make propagation part of the messaging library your teams share.
Q190 Tempo returns trace not found for traces that exist a few minutes later
Intermediate
trace not found for traces that exist a few minutes laterLikely causes โ Querying before ingesters flush, or the querier isn't configured to query ingesters for recent data (query_backend_after/query_ingesters_until).
Diagnose โ Retry after a minute; check Tempo querier config and ingester health.
Fix โ Make sure the query frontend searches both ingesters and backend for recent windows; check ingester replication.
Prevent โ Monitor tempo_ingester_live_traces and flush durations.
Q191 Trace timing looks impossible: child span starts before its parent
Advanced
Likely causes โ Clock skew between hosts, since each service stamps its own spans.
Diagnose โ Compare node_timex_offset_seconds across hosts; check chrony status.
Fix โ Fix NTP (chrony with Amazon Time Sync 169.254.169.123 on EC2); Jaeger UI has clock skew adjustment but it only masks the issue.
Prevent โ Alert on clock offset > 50ms.
Q192 Exemplars don't show on Grafana latency graphs
Advanced
Likely causes โ Prometheus isn't started with --enable-feature=exemplar-storage, the app doesn't attach trace IDs to observations, scraping doesn't use OpenMetrics, or the panel's "Exemplars" toggle is off.
Diagnose โ
curl -s -H 'Accept: application/openmetrics-text' http://app:8080/metrics | grep '# {trace_id'Fix โ Enable exemplar storage, use a client library that attaches exemplars from the active span, toggle Exemplars in the query, and configure the data source's exemplar link to Tempo with trace_id.
Prevent โ Include exemplars in the instrumentation library defaults.
Q193 CloudWatch agent is running but no custom metrics appear in the CWAgent namespace
Beginner
CWAgent namespaceLikely causes โ IAM role lacks cloudwatch:PutMetricData, the agent runs with the default config (not yours), or you're looking in the wrong region.
Diagnose โ
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a status
sudo tail -50 /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.logFix โ Attach CloudWatchAgentServerPolicy to the instance role, then load your config:
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \
-a fetch-config -m ec2 -s -c file:/opt/aws/amazon-cloudwatch-agent/etc/config.jsonPrevent โ Bake agent + config into the AMI or SSM State Manager association.
Q194 CloudWatch agent log shows AccessDeniedException: User: arn:aws:sts::...:assumed-role/... is not authorized to perform: logs:PutLogEvents
Beginner
AccessDeniedException: User: arn:aws:sts::...:assumed-role/... is not authorized to perform: logs:PutLogEventsLikely causes โ Role permissions cover metrics but not logs, or log group is encrypted with a KMS key the role can't use.
Diagnose โ Read the agent log; check the role and the log group's kmsKeyId.
Fix โ Grant logs:CreateLogGroup, logs:CreateLogStream, logs:PutLogEvents, logs:DescribeLogStreams (included in CloudWatchAgentServerPolicy) and KMS kms:GenerateDataKey/kms:Encrypt if needed.
Prevent โ Use a single managed policy for all agent hosts.
Q195 CloudWatch agent on a private subnet logs RequestError: send request failed ... dial tcp ...:443: i/o timeout
Intermediate
RequestError: send request failed ... dial tcp ...:443: i/o timeoutLikely causes โ No NAT gateway and no VPC interface endpoints for monitoring and logs.
Diagnose โ
curl -sv https://monitoring.ap-south-1.amazonaws.com 2>&1 | head
aws ec2 describe-vpc-endpoints --filters Name=vpc-id,Values=vpc-xxxFix โ Create interface endpoints com.amazonaws.<region>.monitoring and com.amazonaws.<region>.logs with private DNS enabled and a security group allowing 443 from the instances.
Prevent โ Include these endpoints in the VPC Terraform module.
Q196 Memory and disk metrics are missing in CloudWatch for EC2, only CPU shows
Beginner
Likely causes โ EC2 basic monitoring has no in-guest metrics; memory and disk need the CloudWatch agent with mem and disk sections.
Diagnose โ Look for mem_used_percent in the CWAgent namespace.
Fix โ Add to config:
"metrics": { "metrics_collected": {
"mem": { "measurement": ["mem_used_percent"] },
"disk": { "measurement": ["used_percent"], "resources": ["/"] } } }Then fetch-config and restart.
Prevent โ Standard agent config for all instances.
Q197 CloudWatch alarm stays INSUFFICIENT_DATA for an Auto Scaling group's instances
Intermediate
INSUFFICIENT_DATA for an Auto Scaling group's instancesLikely causes โ The alarm's dimensions don't match published ones (e.g. alarm on InstanceId + AutoScalingGroupName but agent publishes only InstanceId), or append_dimensions / aggregation_dimensions weren't configured.
Diagnose โ
aws cloudwatch list-metrics --namespace CWAgent --metric-name mem_used_percentFix โ Add "append_dimensions": {"AutoScalingGroupName": "${aws:AutoScalingGroupName}"} and "aggregation_dimensions": [["AutoScalingGroupName"]]; alarm on the ASG dimension.
Prevent โ Set TreatMissingData deliberately on every alarm.
Q198 Container Insights on EKS shows no data after installing the add-on
Intermediate
Likely causes โ The CloudWatch agent / Fluent Bit pods lack IAM permissions (no IRSA or Pod Identity), or pods are not scheduled on all nodes.
Diagnose โ
kubectl get pods -n amazon-cloudwatch
kubectl logs -n amazon-cloudwatch ds/cloudwatch-agent | grep -i 'denied\|error'Fix โ Associate CloudWatchAgentServerPolicy with the cloudwatch-agent service account via IRSA or EKS Pod Identity, then restart the DaemonSet.
Prevent โ Manage the add-on and its IAM in Terraform together.
Q199 AWS X-Ray console shows segments but service map has disconnected nodes
Advanced
Likely causes โ Mixed propagation: some services emit W3C traceparent via OTel while others expect X-Amzn-Trace-Id; or the ADOT collector exports with non-X-Ray-compatible trace IDs from older SDKs.
Diagnose โ Inspect inbound headers at each hop; check the ADOT collector awsxray exporter logs.
Fix โ Configure the propagators to include X-Ray (OTEL_PROPAGATORS=tracecontext,baggage,xray) and use the X-Ray ID generator where the SDK requires it; send through ADOT with the awsxray exporter.
Prevent โ Pick one propagation standard org-wide and bridge only at edges.
Q200 Prometheus up is fine, logs flow and traces exist, but on-call still can't correlate them during an incident
Advanced
up is fine, logs flow and traces exist, but on-call still can't correlate them during an incidentLikely causes โ Inconsistent identity across signals: service in metrics, app in logs, service.name in traces; no trace IDs in logs; different environment labels.
Diagnose โ Pick one request and try to follow it metric โ trace โ log; note where the trail breaks.
Fix โ Standardise on OTel resource attributes (service.name, deployment.environment, k8s.namespace.name) and map them to the same label names in Prometheus and Loki; log trace_id/span_id in every line; configure Grafana derived fields, exemplars, and Tempo's trace-to-logs/trace-to-metrics links.
Prevent โ A shared instrumentation library and a correlation check in production readiness reviews.