Flag --enable-k8s-exporter=false causes loss of /healthz, /conditions, and /debug/pprof endpoints
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
- Ambito
- backend, observability
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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di kubernetes/node-problem-detector
-
kind/cleanup sig/node
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
kubernetes/node-problem-detector#1331 ·
-
NPD needs significant unit test coverageForse di nuovo libera @DigitalVeer l’ha presa 64 giorni fa e non c’è nessuna pull request aperta. Apertakind/cleanup sig/node
kubernetes/node-problem-detector#1328 · 2 commenti · 1 assegnatario ·
-
kind/bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
kubernetes/node-problem-detector#1176 · 7 commenti ·
-
kind/feature lifecycle/frozen
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
kubernetes/node-problem-detector#1112 · 8 commenti ·
-
Networking probesAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 32/100
kubernetes/node-problem-detector#991 · 23 commenti · 5 reazioni ·
Tutte le issue di kubernetes/node-problem-detector
Issue simili
-
[Docs] - Document minimum Terraform/OpenTofu version (>= 1.11) required by write-only argumentsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
MagaluCloud/terraform-provider-mgc#323 ·
I maintainer di solito rispondono entro 11 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
rossoctl/context-guru#366 ·
I maintainer di solito rispondono entro 1 giorno
-
stage-fail
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
siyuan-note/bazaar#2293 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
piraeusdatastore/piraeus-operator#1070 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno