Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#1,332 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
56/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
go

調査の方向性

startHTTPReporting() と k8sexporter.NewExporterOrDie() からのその呼び出しを追跡し、その後 --enable-k8s-exporter と --port がどのように処理されるかを調べます。診断用 HTTP サーバーを、提案されているスタンドアロンの exporter に分離し、メモリ内の ExportProblems 条件の追跡も含めます。--enable-k8s-exporter=false で、ポート 20256 上の /healthz、/conditions、/debug/pprof/ を確認し、Prometheus メトリクスが引き続き機能することを確認して検証します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Go
スター
3.5k
フォーク
704
平均マージ
12時間 21分
マージ済み PR(30日)
3

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

kubernetes/node-problem-detector のほかの issue

kubernetes/node-problem-detector の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。