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. However, because Kubernetes does not allow having more than one handler of probes you must be sure that you do not define probes to use both exec and httpGet. For consistency, the examples shown in the Default Astronomer Helm probe configurations use httpGet, but can use exec when appropriate.

Liveness probe templates

Readiness probe templates

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.

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:

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.

Default Astronomer Helm probe configurations

The following components have their default probe configuration defined in the Astronomer Helm chart.

If a component does not have probes defined by default, you can see which options can have custom probe configurations.

Alert manager

The following can also be configured to include liveness and readiness probes:

Astronomer

The following can also be configured to include liveness and readiness probes:

Elasticsearch

The following components do not have probes configured by default:

External-es-proxy

The following components do not have probes configured by default:

Fluentd

The following components do not have probes configured by default:

Global

The following components do not have probes configured by default:

Grafana

The following components do not have probes configured by default:

Kibana

The following components do not have probes configured by default:

Kube-state

The following components do not have probes configured by default:

NATS

The following components do not have probes configured by default:

nginx

The following components do not have probes configured by default:

PgBouncer

PostgreSQL

The following components do not have probes configured by default:

Prometheus

The following components do not have probes configured by default:

STAN

The following components do not have probes configured by default:

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

Auth sidecar

The following can also be configured to include liveness and readiness probes:

DAG deploy server

The following can also be configured to include liveness and readiness probes:

Logging sidecar

The following can also be configured to include liveness and readiness probes: