Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Flag --enable-k8s-exporter=false causes loss of /healthz, /conditions, and /debug/pprof endpoints

Aperta
#1,332 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
56/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
go

Direzione di ricerca

Traccia startHTTPReporting() e la sua chiamata da k8sexporter.NewExporterOrDie(), quindi esamina come vengono gestiti --enable-k8s-exporter e --port. Separa il server HTTP diagnostico nell’exporter standalone proposto, incluso il tracciamento in memoria delle condizioni di ExportProblems. Convalida con --enable-k8s-exporter=false verificando /healthz, /conditions e /debug/pprof/ sulla porta 20256, mentre le metriche Prometheus continuano a funzionare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

When running NPD outside of Kubernetes (e.g. on a bare host or in a VM without a cluster), passing --enable-k8s-exporter=false is required to avoid a panic at startup. However, this flag also silently removes the HTTP diagnostic server on --port (default 20256), losing access to /healthz, /conditions, and /debug/pprof/.

Root cause

startHTTPReporting(), the function that starts the /healthz, /conditions, and pprof handlers, is called exclusively inside k8sexporter.NewExporterOrDie().
When --enable-k8s-exporter=false, that function returns nil immediately and the HTTP server is never started, even though --port is set to a non-zero value.

Steps to reproduce

❯ docker run --rm --name npd --privileged -v /dev/kmsg:/dev/kmsg:ro registry.k8s.io/node-problem-detector/node-problem-detector:v1.36.0 \
  --enable-k8s-exporter=false \
  --prometheus-port=20257 \
  --config.custom-plugin-monitor=config/custom-plugin-monitor.json

❯ docker exec -ti npd bash
# Prometheus metrics work:
$ curl -Is http://127.0.0.1:20257/metrics
HTTP/1.1 200 OK
Content-Type: text/plain; version=0.0.4; charset=utf-8; escaping=underscores
Date: Mon, 03 Aug 2026 12:06:56 GMT
Content-Length: 1255

# But the HTTP server is gone:
$ curl http://127.0.0.1:20256/healthz
curl: (7) Failed to connect to 127.0.0.1 port 20256 after 0 ms: Couldn\'t connect to server
$ curl http://127.0.0.1:20256/conditions
curl: (7) Failed to connect to 127.0.0.1 port 20256 after 0 ms: Couldn\'t connect to server
$ curl http://127.0.0.1:20256/debug/pprof/
curl: (7) Failed to connect to 127.0.0.1 port 20256 after 0 ms: Couldn\'t connect to server
$

Expected behavior

/healthz, /conditions, and /debug/pprof should be available on --port regardless of whether --enable-k8s-exporter is true or false.
The Prometheus metrics endpoint (problem_counter, problem_gauge, etc.) already works without Kubernetes because those metrics are written directly by the problem daemons via OpenCensus; the HTTP diagnostic server should behave the same way.

Fix

Move the HTTP server out of the K8s exporter into a standalone httpexporter that tracks conditions in-memory via ExportProblems and is started independently of --enable-k8s-exporter.

Lingua principale
Go
Stelle
3.5k
Fork
704
Merge medio
12h 21m
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di kubernetes/node-problem-detector

Tutte le issue di kubernetes/node-problem-detector

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.