From 179989ebb1311ae5ee9bf91484b2ea471f4ee1fb Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Wed, 15 May 2024 19:08:42 +0200 Subject: [PATCH] Change kine metrics port from 8080 to 2380 The default port is 8080. This conflicts with kube-router, which since 2.x fails if it cannot bind to its metrics port. This leads to a situation where the default configuration for a single node k0s cluster is broken, as kube-router will go into a crash loop. Kube-router 1.x will not be able to provide metrics, but will simply log the error and move on. The integration tests did not cover this case properly, as the kube-router manifests did not specify a readiness probe that the inttests need to detect problems with daemon sets. Port 2380 was chosen because it is normally used by etcd. Kine also uses port 2379 for the client API, so why not use 2380 as well? Signed-off-by: Tom Wieczorek --- pkg/component/controller/kine.go | 2 ++ pkg/component/controller/metrics.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/component/controller/kine.go b/pkg/component/controller/kine.go index 2b3e31e67006..eb199b042db7 100644 --- a/pkg/component/controller/kine.go +++ b/pkg/component/controller/kine.go @@ -118,6 +118,8 @@ func (k *Kine) Start(ctx context.Context) error { // invalid URLs that are understood by kine. // https://github.com/k3s-io/kine/blob/v0.10.1/pkg/endpoint/endpoint.go#L277-L285 fmt.Sprintf("--listen-address=unix://%s", k.K0sVars.KineSocketPath), + // Enable metrics on port 2380. The default is 8080, which clashes with kube-router. + "--metrics-bind-address=:2380", }, UID: k.uid, GID: k.gid, diff --git a/pkg/component/controller/metrics.go b/pkg/component/controller/metrics.go index a76bd49e9f43..01412e60c8a5 100644 --- a/pkg/component/controller/metrics.go +++ b/pkg/component/controller/metrics.go @@ -205,7 +205,7 @@ func (m *Metrics) newKineJob() (*job, error) { return &job{ log: m.log.WithField("metrics_job", "kine"), - scrapeURL: "http://localhost:8080/metrics", + scrapeURL: "http://localhost:2380/metrics", name: "kine", hostname: m.hostname, scrapeClient: httpClient,