> ## Documentation Index
> Fetch the complete documentation index at: https://astronomer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure probes

In Astro Private Cloud (APC), you can create liveness and readiness probes to assess whether your Kubernetes Pods or network are healthy and can process requests.

Some components in APC include liveness and readiness probes by default, but all components support adding and configuring them. APC allows you to use the [Kubernetes liveness and readiness probe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes) definitions so you can monitor the state of your Pods.

<Tip>
  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.
  * If a container doesn't have open ports but has multiple processes.
  * If a process in a container might never reach a `healthy` state because it's waiting for some state to be achieved.
</Tip>

## 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 add any definitions that are compatible with [Kubernetes probes](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes). However, because Kubernetes doesn't allow having more than one handler of probes, you must be sure that you don't define probes that use both `exec` and `httpGet`. For consistency, the examples shown in the [Default Astronomer Helm probe configurations](#default-astronomer-helm-probe-configurations) use `httpGet`, but you can use `exec` when appropriate.

### Liveness probe templates

```yaml wrap theme={null}

livenessProbe:
  enabled: true
  httpGet:
    path: /index.html
    port: 443
```

### Readiness probe templates

```yaml wrap theme={null}

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 the APC API.

```bash wrap theme={null}
kubectl -n "${NAMESPACE}" get deployment -l component=houston -o yaml
```

This command produces a large amount of YAML output describing your APC API configuration. Within this output is a section describing the `livenessProbe`, which looks like this:

```yaml wrap theme={null}
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 APC API configuration, then adjust the values you want to customize. Then [apply a platform config change](/docs/astro-private-cloud/v-2-x/apply-platform-config).

## Reference Helm values within your probes

The liveness and readiness probes specified in Helm values are passed through the Helm template function, which allows you to reference other Helm values within the probes. Specifically, the `livenessProbe` and `readinessProbe` values are rendered to YAML, then passed through the Helm template function, which renders any Helm template syntax 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 `alertmanager` YAML configuration, shows how the path and ports are defined by `Values.ports.http` and `Values.prefixURL` elsewhere in the `values.yaml` file.

```yaml wrap theme={null}
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](https://github.com/astronomer/astronomer).

If a component doesn't have probes defined by default, you can see which components support custom probe configurations below.

### Airflow operator

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

```yaml wrap theme={null}
airflow-operator:
  livenessProbe: {}
  readinessProbe: {}
```

### Alert manager

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

```yaml wrap theme={null}
alertmanager:
  livenessProbe: {}
  readinessProbe: {}
```

### Astronomer

```yaml expandable wrap theme={null}
astronomer:
  astroUI:
    livenessProbe:
      httpGet:
        path: /
        port: 8080
      initialDelaySeconds: 10
      periodSeconds: 10
    readinessProbe:
      httpGet:
        path: /
        port: 8080
      initialDelaySeconds: 10
      periodSeconds: 10
  commander:
    livenessProbe:
      httpGet:
        path: /healthz
        port: 8880
        scheme: HTTP
      initialDelaySeconds: 10
      periodSeconds: 10
      failureThreshold: 5
      successThreshold: 1
      timeoutSeconds: 5
    readinessProbe:
      httpGet:
        path: /healthz
        port: 8880
      initialDelaySeconds: 10
      periodSeconds: 10
  houston:
    livenessProbe:
      httpGet:
        path: /v1/healthz
        port: 8871
      initialDelaySeconds: 30
      periodSeconds: 10
      failureThreshold: 10
    readinessProbe:
      httpGet:
        path: /v1/healthz
        port: 8871
      initialDelaySeconds: 30
      periodSeconds: 10
      failureThreshold: 10
  registry:
    livenessProbe:
      httpGet:
        path: /
        port: 5000
      initialDelaySeconds: 10
      periodSeconds: 10
      timeoutSeconds: 5
    readinessProbe:
      httpGet:
        path: /
        port: 5000
      initialDelaySeconds: 10
      periodSeconds: 10
      timeoutSeconds: 5
```

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

```yaml expandable wrap theme={null}
astronomer:
  configSyncer:
    livenessProbe: {}
    readinessProbe: {}
  houston:
    bootstrapper:
      livenessProbe: {}
      readinessProbe: {}
    cleanupAirflowDb:
      livenessProbe: {}
      readinessProbe: {}
    cleanupClusterAudits:
      livenessProbe: {}
      readinessProbe: {}
    cleanupDeployRevisions:
      livenessProbe: {}
      readinessProbe: {}
    cleanupDeployments:
      livenessProbe: {}
      readinessProbe: {}
    dbMigration:
      livenessProbe: {}
      readinessProbe: {}
    syncDataplaneClusters:
      livenessProbe: {}
      readinessProbe: {}
    taskUsageMetrics:
      livenessProbe: {}
      readinessProbe: {}
    updateCheck:
      livenessProbe: {}
      readinessProbe: {}
    updateResourceStrategy:
      livenessProbe: {}
      readinessProbe: {}
    updateRuntimeCheck:
      livenessProbe: {}
      readinessProbe: {}
    upgradeDeployments:
      livenessProbe: {}
      readinessProbe: {}
    waitForDB:
      livenessProbe: {}
      readinessProbe: {}
    worker:
      livenessProbe: {}
      readinessProbe: {}
```

### Elasticsearch

```yaml expandable wrap theme={null}
elasticsearch:
  client:
    livenessProbe:
      httpGet:
        path: /_cluster/health?local=true
        port: 9200
      initialDelaySeconds: 90
    readinessProbe:
      httpGet:
        path: /_cluster/health?local=true
        port: 9200
      initialDelaySeconds: 5
  exporter:
    livenessProbe:
      httpGet:
        path: /healthz
        port: http
      initialDelaySeconds: 30
      timeoutSeconds: 10
    readinessProbe:
      httpGet:
        path: /healthz
        port: http
      initialDelaySeconds: 10
      timeoutSeconds: 10
  master:
    livenessProbe:
      tcpSocket:
        port: 9300
    readinessProbe:
      httpGet:
        path: /_cluster/health?local=true
        port: 9200
      initialDelaySeconds: 5
```

The following components don't have probes configured by default:

```yaml expandable wrap theme={null}
elasticsearch:
  curator:
    livenessProbe:
      exec:
        command:
        - /bin/true
    readinessProbe:
      exec:
        command:
        - /bin/true
  data:
    livenessProbe:
      exec:
        command:
        - /bin/true
    readinessProbe:
      exec:
        command:
        - /bin/true
  nginx:
    livenessProbe:
      exec:
        command:
        - /bin/true
    readinessProbe:
      exec:
        command:
        - /bin/true
  sysctlInitContainer:
    livenessProbe:
      exec:
        command:
        - /bin/true
    readinessProbe:
      exec:
        command:
        - /bin/true
```

### External-es-proxy

The following components don't have probes configured by default:

```yaml wrap theme={null}
external-es-proxy:
  awsproxy:
    livenessProbe:
      exec:
        command:
        - /bin/true
    readinessProbe:
      exec:
        command:
        - /bin/true
  livenessProbe:
    exec:
      command:
      - /bin/true
  readinessProbe:
    exec:
      command:
      - /bin/true
```

### Vector

The following components don't have probes configured by default:

```yaml wrap theme={null}
vector:
  vector:
    livenessProbe:
      exec:
        command:
        - /bin/true
    readinessProbe:
      exec:
        command:
        - /bin/true
```

### Global

The following components don't have probes configured by default:

```yaml wrap theme={null}
global:
  authSidecar:
    livenessProbe: {}
    readinessProbe: {}
```

### Grafana

```yaml wrap theme={null}
grafana:
  livenessProbe:
    httpGet:
      path: /api/health
      port: 3000
    initialDelaySeconds: 10
    periodSeconds: 10
  readinessProbe:
    httpGet:
      path: /api/health
      port: 3000
    initialDelaySeconds: 10
    periodSeconds: 10
```

The following components don't have probes configured by default:

```yaml wrap theme={null}
grafana:
  bootstrapper:
    livenessProbe: {}
    readinessProbe: {}
  waitForDB:
    livenessProbe: {}
    readinessProbe: {}
```

### Kube-state

The following components don't have probes configured by default:

```yaml wrap theme={null}
kube-state:
  livenessProbe: {}
  readinessProbe: {}
```

### NATS

```yaml wrap theme={null}
nats:
  nats:
    livenessProbe:
      httpGet:
        path: /
        port: 8222
      initialDelaySeconds: 10
      timeoutSeconds: 5
    readinessProbe:
      httpGet:
        path: /
        port: 8222
      initialDelaySeconds: 10
      timeoutSeconds: 5
```

The following components don't have probes configured by default:

```yaml wrap theme={null}
nats:
  exporter:
    enabled: true
    livenessProbe:
      exec:
        command:
        - /bin/true
    readinessProbe:
      exec:
        command:
        - /bin/true
  reloader:
    livenessProbe:
      exec:
        command:
        - /bin/true
    readinessProbe:
      exec:
        command:
        - /bin/true
```

### nginx

The following components don't have probes configured by default:

```yaml wrap theme={null}
nginx:
  defaultBackend:
    livenessProbe:
      exec:
        command:
        - /bin/true
    readinessProbe:
      exec:
        command:
        - /bin/true
  livenessProbe:
    exec:
      command:
      - /bin/true
  readinessProbe:
    exec:
      command:
      - /bin/true
```

### PgBouncer

```yaml wrap theme={null}
pgbouncer:
  livenessProbe:
    tcpSocket:
      port: 5432
  readinessProbe:
    tcpSocket:
      port: 5432
```

### PostgreSQL

```yaml wrap theme={null}
postgresql:
  livenessProbe:
    exec:
      command:
        - sh
        - -c
        - exec pg_isready -U "postgres" -h 127.0.0.1 -p 5432
    initialDelaySeconds: 30
    periodSeconds: 10
    timeoutSeconds: 5
    successThreshold: 1
    failureThreshold: 6
  readinessProbe:
    exec:
      command:
        - sh
        - -c
        - -e
        - 'pg_isready -U "postgres" -h 127.0.0.1 -p 5432\n'
    initialDelaySeconds: 5
    periodSeconds: 10
    timeoutSeconds: 5
    successThreshold: 1
    failureThreshold: 6
```

The following components don't have probes configured by default:

```yaml wrap theme={null}
postgresql:
  metrics:
    livenessProbe: {}
    readinessProbe: {}
```

### Prometheus

```yaml wrap theme={null}
prometheus:
  livenessProbe:
    httpGet:
      path: /-/healthy
      port: 9090
    initialDelaySeconds: 10
    periodSeconds: 5
    failureThreshold: 3
    timeoutSeconds: 1
  readinessProbe:
    httpGet:
      path: /-/ready
      port: 9090
    initialDelaySeconds: 10
    periodSeconds: 5
    failureThreshold: 3
    timeoutSeconds: 1
prometheus-postgres-exporter:
  livenessProbe:
    tcpSocket:
      port: 9187
    initialDelaySeconds: 5
    periodSeconds: 10
  readinessProbe:
    tcpSocket:
      port: 9187
    initialDelaySeconds: 5
    periodSeconds: 10
```

The following components don't have probes configured by default:

```yaml wrap theme={null}
prometheus:
  configMapReloader:
    livenessProbe: {}
    readinessProbe: {}
  federation:
    livenessProbe: {}
    readinessProbe: {}
  filesdReloader:
    livenessProbe: {}
    readinessProbe: {}
```

### STAN

```yaml wrap theme={null}
    livenessProbe:
      httpGet:
        path: /streaming/serverz
        port: monitor
      initialDelaySeconds: 10
      timeoutSeconds: 5
    readinessProbe:
      httpGet:
        path: /streaming/serverz
        port: monitor
      initialDelaySeconds: 10
      timeoutSeconds: 5
```

The following components don't have probes configured by default:

```yaml wrap theme={null}
stan:
  exporter:
    livenessProbe:
      exec:
        command:
        - /bin/true
    readinessProbe:
      exec:
        command:
        - /bin/true
  stan:
    nats:
      livenessProbe:
        exec:
          command:
          - /bin/true
      readinessProbe:
        exec:
          command:
          - /bin/true
  waitForNatsServer:
    livenessProbe:
      exec:
        command:
        - /bin/true
    readinessProbe:
      exec:
        command:
        - /bin/true
```

## Default Airflow chart probe configurations

You can also define liveness and readiness probes using the [Astronomer Airflow chart](https://github.com/astronomer/airflow-chart).

### Airflow

This includes:

* `dagProcessor`
* `flower`
* `pgbouncer`
* `postgresql`
* `scheduler`
* `triggerer`
* `webserver`
* `workers`

```yaml expandable wrap theme={null}
airflow:
  dagProcessor:
    livenessProbe:
      command: null
      failureThreshold: 5
      initialDelaySeconds: 10
      periodSeconds: 60
      timeoutSeconds: 20
    readinessProbe:
      initialDelaySeconds: 10
      timeoutSeconds: 20
      failureThreshold: 5
      periodSeconds: 60
    logGroomerSidecar:
      enabled: true
      livenessProbe:
        initialDelaySeconds: 60
        timeoutSeconds: 20
        failureThreshold: 5
        periodSeconds: 60
      readinessProbe:
        initialDelaySeconds: 60
        timeoutSeconds: 20
        failureThreshold: 5
        periodSeconds: 60
  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

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

```yaml wrap theme={null}
authSidecar:
  livenessProbe: {}
  readinessProbe: {}
```

### Dag deploy server

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

```yaml wrap theme={null}
dagDeploy:
  livenessProbe: {}
  readinessProbe: {}
```

### Logging sidecar

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

```yaml wrap theme={null}
loggingSidecar:
  livenessProbe: {}
  readinessProbe: {}
```
