Skip to content

Commit

Permalink
install/kubernetes: use HTTP for agent {liveness,readiness}Probe
Browse files Browse the repository at this point in the history
Use the newly introduced /healthz HTTP path exposed on localhost to
check for liveness/readiness of the Cilium agent.

In the long term this would also allow to exclude the cilium CLI tool
from the runtime image and move it into a separate image used with an
ephemeral container for debugging.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
  • Loading branch information
tklauser authored and tgraf committed May 12, 2020
1 parent 7e5cc77 commit d613dea
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions daemon/cmd/agenthealth.go
Expand Up @@ -52,7 +52,7 @@ func (d *Daemon) startAgentHealthHTTPService(addr string) {
lc := net.ListenConfig{Control: setsockoptReuseAddrAndPort}
ln, err := lc.Listen(context.Background(), "tcp", addr)
if err != nil {
log.Fatal(err)
log.WithError(err).Fatalf("Unable to listen on %s for healthz status API server", addr)
}

mux := http.NewServeMux()
Expand Down Expand Up @@ -82,7 +82,7 @@ func (d *Daemon) startAgentHealthHTTPService(addr string) {
if err == http.ErrServerClosed {
log.Info("healthz status API server shutdown")
} else if err != nil {
log.WithError(err).Fatal("Unable to start status healthz status API server")
log.WithError(err).Fatal("Unable to start healthz status API server")
}
}()
log.Infof("Started healthz status API server on address %s", addr)
Expand Down
20 changes: 10 additions & 10 deletions install/kubernetes/cilium/charts/agent/templates/daemonset.yaml
Expand Up @@ -55,11 +55,11 @@ spec:
command:
- cilium-agent
livenessProbe:
exec:
command:
- cilium
- status
- --brief
httpGet:
host: '127.0.0.1'
path: /healthz
port: {{ .Values.global.agent.healthPort }}
scheme: HTTP
failureThreshold: 10
# The initial delay for the liveness probe is intentionally large to
# avoid an endless kill & restart cycle if in the event that the initial
Expand All @@ -69,11 +69,11 @@ spec:
successThreshold: 1
timeoutSeconds: 5
readinessProbe:
exec:
command:
- cilium
- status
- --brief
httpGet:
host: '127.0.0.1'
path: /healthz
port: {{ .Values.global.agent.healthPort }}
scheme: HTTP
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 30
Expand Down
20 changes: 10 additions & 10 deletions install/kubernetes/quick-install.yaml
Expand Up @@ -364,11 +364,11 @@ spec:
command:
- cilium-agent
livenessProbe:
exec:
command:
- cilium
- status
- --brief
httpGet:
host: '127.0.0.1'
path: /healthz
port: 9876
scheme: HTTP
failureThreshold: 10
# The initial delay for the liveness probe is intentionally large to
# avoid an endless kill & restart cycle if in the event that the initial
Expand All @@ -378,11 +378,11 @@ spec:
successThreshold: 1
timeoutSeconds: 5
readinessProbe:
exec:
command:
- cilium
- status
- --brief
httpGet:
host: '127.0.0.1'
path: /healthz
port: 9876
scheme: HTTP
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 30
Expand Down

0 comments on commit d613dea

Please sign in to comment.