Adds readinessProbe and livenessProbe to prometheus-adapter jsonnet

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
This commit is contained in:
Joao Marcal
2022-03-23 16:51:15 +00:00
parent b38868e361
commit 3fa00f11f3

View File

@@ -220,6 +220,26 @@ function(params) {
'--tls-cipher-suites=' + std.join(',', pa._config.tlsCipherSuites), '--tls-cipher-suites=' + std.join(',', pa._config.tlsCipherSuites),
], ],
resources: pa._config.resources, resources: pa._config.resources,
readinessProbe: {
httpGet: {
path: '/readyz',
port: 'https',
scheme: 'HTTPS',
},
initialDelaySeconds: 30,
periodSeconds: 5,
failureThreshold: 5,
},
livenessProbe: {
httpGet: {
path: '/livez',
port: 'https',
scheme: 'HTTPS',
},
initialDelaySeconds: 30,
periodSeconds: 5,
failureThreshold: 5,
},
ports: [{ containerPort: 6443 }], ports: [{ containerPort: 6443 }],
volumeMounts: [ volumeMounts: [
{ name: 'tmpfs', mountPath: '/tmp', readOnly: false }, { name: 'tmpfs', mountPath: '/tmp', readOnly: false },