Skip to content

Commit

Permalink
Adds readinessProbe and livenessProbe to prometheus-adapter jsonnet
Browse files Browse the repository at this point in the history
Problem: Currently the prometheus-adapter pods are restarted at the same
time even though the deployment is configured with strategy RollingUpdate.
This happens because the kubelet does not know when the prometheus-adapter
pods are ready to start receiving requests.

Solution: Add both readinessProbe and livenessProbe to the
prometheus-adapter, this way the kubelet will know when either the pod
stoped working and should be restarted or simply when it ready to start
receiving requests.

Issue: https://bugzilla.redhat.com/show_bug.cgi?id=2048333
  • Loading branch information
JoaoBraveCoding committed Mar 23, 2022
1 parent c11f002 commit cb76d4e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions jsonnet/kube-prometheus/components/prometheus-adapter.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,30 @@ local defaults = {
requests: { cpu: '102m', memory: '180Mi' },
limits: { cpu: '250m', memory: '180Mi' },
},
livenessProbe:: {
livenessProbe: {
httpGet: {
path: '/healthz',
port: 'https',
scheme: 'HTTPS',
},
initialDelaySeconds: 5,
periodSeconds: 30,
failureThreshold: 5,
},
},
readinessProbe:: {
readinessProbe: {
httpGet: {
path: '/healthz',
port: 'https',
scheme: 'HTTPS',
},
initialDelaySeconds: 5,
periodSeconds: 5,
failureThreshold: 5,
},
},
replicas:: 2,
listenAddress:: '127.0.0.1',
port:: 9100,
Expand Down Expand Up @@ -220,6 +244,8 @@ function(params) {
'--tls-cipher-suites=' + std.join(',', pa._config.tlsCipherSuites),
],
resources: pa._config.resources,
readinessProbe: pa._config.readinessProbe,
livenessProbe: pa._config.livenessProbe,
ports: [{ containerPort: 6443 }],
volumeMounts: [
{ name: 'tmpfs', mountPath: '/tmp', readOnly: false },
Expand Down

0 comments on commit cb76d4e

Please sign in to comment.