Configure liveness and readiness probes
In Astronomer Software, you can create liveness and readiness probes to assess whether your Kubernetes Pods or network are healthy and can process requests.
Some components in Astronomer Software include liveness and readiness probes by default, but all components support adding and configuring them. Astronomer Software allows you to use the Kubernetes liveness and readiness probe definitions so you can monitor the state of your Pods.
Liveness probes can be useful in all cases. However, readiness probes might be most useful for the following scenarios:
- If you have network ports open on the container
- Containers that do not have open ports, but have multiple processes within the container
- A setup where a process in a container might never reach a
healthy
state because it is waiting for some state to be achieved.
Default probe behavior
You can use the following structure to define your probes in your values.yaml
file. For example, you might want to adjust any default values by configuring the amount of time until a timeout. You can refer to some of the existing Default probe configurations.
You can add any definitions that are compatible with Kubernetes probes.
Liveness probe template
livenessProbe:
enabled: true
httpGet:
path: /index.html
port: 443
Readiness probe template
readinessProbe:
enabled: true
httpGet:
path: /index.html
port: 444
Retrieve existing probe definitions
You can retrieve the default probe definitions from the Kubernetes manifest. The following example shows how to retrieve the definitions for Houston.
kubectl -n "${NAMESPACE}" get deployment -l component=houston -o yaml
This command produces a large amount of yaml output describing your Houston configuration. Within this output, is a section describing the livenessProbe
, which looks like the following:
livenessProbe:
failureThreshold: 10
httpGet:
path: /v1/healthz
port: 8871
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
You can copy and paste this output into your values.yaml
file for your Houston configuration, then adjust the values you want to customize. Then apply a platform config change.
Reference Helm values within your probes
Because values for the liveness and readiness probes are passed through the Helm template function, you can reference Helm values within the probes. Specifically, the livenessProbe
and readiness
values are rendered to yaml, then passed through the Helm template function, which renders any Helm template syntaxes into the produced yaml.
For example, instead of hardcoding values for your probes to match values defined by other configurations in your values.yaml
file, you can use the configuration variable itself.
The following example, using the alertsmanager
yaml configuration, shows how the path and ports are defined by Values.ports.http
and Values.prefixURL
elsewhere in the values.yaml
file.
readinessProbe:
httpGet:
path: {{ .Values.prefixURL }}/#/status
port: {{ .Values.ports.http }}
initialDelaySeconds: 30
timeoutSeconds: 30
Default Astronomer Helm probe configurations
The following components have their default probe configuration defined in the Astronomer Helm chart.
Alert manager
alertmanager:
readinessProbe: {}
Astronomer
astronomer:
astroUI:
livenessProbe: {}
readinessProbe: {}
commander:
livenessProbe: {}
readinessProbe: {}
houston:
bootstrapper:
livenessProbe: {}
readinessProbe: {}
livenessProbe: {}
readinessProbe: {}
waitForDB:
livenessProbe: {}
readinessProbe: {}
worker:
livenessProbe: {}
readinessProbe: {}
registry:
livenessProbe: {}
readinessProbe: {}
Elasticsearch
elasticsearch:
client:
livenessProbe: {}
readinessProbe: {}
data:
livenessProbe: {}
readinessProbe: {}
exporter:
livenessProbe: {}
readinessProbe: {}
master:
livenessProbe: {}
readinessProbe: {}
sysctlInitContainer:
livenessProbe: {}
readinessProbe: {}
External-es-proxy
external-es-proxy:
awsproxy:
livenessProbe: {}
readinessProbe: {}
Fluentd
fluentd:
livenessProbe: {}
readinessProbe: {}
Global
global:
authSidecar:
livenessProbe: {}
readinessProbe: {}
dagOnlyDeployment:
client:
livenessProbe: {}
readinessProbe: {}
server:
livenessProbe: {}
readinessProbe: {}
loggingSidecar:
livenessProbe: {}
readinessProbe: {}
Grafana
grafana:
bootstrapper:
livenessProbe: {}
readinessProbe: {}
waitForDB:
livenessProbe: {}
readinessProbe: {}
Kibana
kibana:
livenessProbe: {}
readinessProbe: {}
Kube-state
kube-state:
livenessProbe: {}
readinessProbe: {}
NATS
nats:
nats:
livenessProbe: {}
readinessProbe: {}
nginx
nginx:
defaultBackend:
livenessProbe: {}
readinessProbe: {}
livenessProbe: {}
readinessProbe: {}
PgBouncer
pgbouncer:
livenessProbe: {}
readinessProbe: {}
PostgreSQL
postgresql:
livenessProbe: {}
metrics:
livenessProbe: {}
readinessProbe: {}
readinessProbe: {}
Prometheus
prometheus:
configMapReloader:
livenessProbe: {}
readinessProbe: {}
filesdReloader:
livenessProbe: {}
readinessProbe: {}
livenessProbe: {}
readinessProbe: {}
prometheus-blackbox-exporter:
livenessProbe: {}
readinessProbe: {}
prometheus-node-exporter:
livenessProbe: {}
readinessProbe: {}
prometheus-postgres-exporter:
livenessProbe: {}
readinessProbe: {}
STAN
stan:
stan:
livenessProbe: {}
nats:
livenessProbe: {}
readinessProbe: {}
readinessProbe: {}
waitForNatsServer:
livenessProbe: {}
readinessProbe: {}
Default Airflow chart probe configurations
You can also define liveness and readiness probes using the Astronomer Airflow chart.
Airflow
This includes:
dagProcessor
flower
pgbouncer
postgresql
scheduler
triggerer
webserver
workers
airflow:
dagProcessor:
livenessProbe:
command: null
failureThreshold: 5
initialDelaySeconds: 10
periodSeconds: 60
timeoutSeconds: 20
flower:
livenessProbe:
failureThreshold: 10
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 5
readinessProbe:
failureThreshold: 10
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 5
pgbouncer:
metricsExporterSidecar:
livenessProbe:
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 1
readinessProbe:
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 1
postgresql:
metrics:
customLivenessProbe: {}
customReadinessProbe: {}
livenessProbe:
enabled: true
failureThreshold: 6
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
readinessProbe:
enabled: true
failureThreshold: 6
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
primary:
customLivenessProbe: {}
customReadinessProbe: {}
livenessProbe:
enabled: true
failureThreshold: 6
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
readinessProbe:
enabled: true
failureThreshold: 6
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
readReplicas:
customLivenessProbe: {}
customReadinessProbe: {}
livenessProbe:
enabled: true
failureThreshold: 6
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
readinessProbe:
enabled: true
failureThreshold: 6
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
scheduler:
livenessProbe:
command: null
failureThreshold: 5
initialDelaySeconds: 10
periodSeconds: 60
timeoutSeconds: 30
triggerer:
livenessProbe:
command: null
failureThreshold: 5
initialDelaySeconds: 10
periodSeconds: 60
timeoutSeconds: 20
webserver:
livenessProbe:
failureThreshold: 5
initialDelaySeconds: 15
periodSeconds: 10
scheme: HTTP
timeoutSeconds: 5
readinessProbe:
failureThreshold: 5
initialDelaySeconds: 15
periodSeconds: 10
scheme: HTTP
timeoutSeconds: 5
workers:
livenessProbe:
command: null
enabled: true
failureThreshold: 5
initialDelaySeconds: 10
periodSeconds: 60
timeoutSeconds: 20
Auth sidecar
authSidecar:
livenessProbe: {}
readinessProbe: {}
DAG deploy server
dagDeploy:
livenessProbe: {}
readinessProbe: {}
Loging sidecar
loggingSidecar:
livenessProbe: {}
readinessProbe: {}