Skip to content

Commit

Permalink
health: Fix cluster-health-port for health endpoint
Browse files Browse the repository at this point in the history
To determine cluster health, Cilium exposes a HTTP server both on each
node, as well as on the artificial health endpoint running on each node.
The port used for this HTTP server is the same and can be configured via
`cluster-health-port` (introduced in cilium#16926) and defaults to 4240.

This commit fixes a bug where the port specified by
`cluster-health-port` was not passed to the Cilium health endpoint
responder. Which meant that `cilium-health-responder` was always
listening on the default port instead of the one configured by the user,
while the probe tried to connect via `cluster-health-port`. This
resulted in the cluster being reported us unhealthy whenever
`cluster-health-port` was set to a non-default value (which is the case
our OpenShift OLM for v1.11):

```
Nodes:
  gandro-7bmc2-worker-2-blgxf.c.cilium-dev.internal (localhost):
    Host connectivity to 10.0.128.2:
      ICMP to stack:   OK, RTT=634.746µs
      HTTP to agent:   OK, RTT=228.066µs
    Endpoint connectivity to 10.128.11.73:
      ICMP to stack:   OK, RTT=666.83µs
      HTTP to agent:   Get "http://10.128.11.73:9940/hello": dial tcp 10.128.11.73:9940: connect: connection refused
```

Fixes: e624868 ("health: Add a flag to set HTTP port")

Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
  • Loading branch information
gandro authored and qmonnet committed Nov 30, 2021
1 parent 420028f commit c640c71
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cilium-health/launch/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func LaunchAsEndpoint(baseCtx context.Context,

pidfile := filepath.Join(option.Config.StateDir, PidfilePath)
prog := "ip"
args := []string{"netns", "exec", netNSName, binaryName, "--pidfile", pidfile}
args := []string{"netns", "exec", netNSName, binaryName, "--listen", strconv.Itoa(option.Config.ClusterHealthPort), "--pidfile", pidfile}
cmd.SetTarget(prog)
cmd.SetArgs(args)
log.Debugf("Spawning health endpoint with command %q %q", prog, args)
Expand Down

0 comments on commit c640c71

Please sign in to comment.