Skip to content

Commit

Permalink
Change kine metrics port from 8080 to 2380
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
twz123 committed May 15, 2024
1 parent 0b2ad54 commit 004848c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/component/controller/kine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pkg/component/controller/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 004848c

Please sign in to comment.