Skip to content

Commit 94da35f

Browse files
committed
docs: import CloudNativePG main
1 parent 0d5f46e commit 94da35f

1 file changed

Lines changed: 29 additions & 8 deletions

File tree

website/docs/instance_manager.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ of the Pod, the instance manager acts as a backend to handle the
2525
## Startup Probe
2626

2727
The startup probe ensures that a PostgreSQL instance, whether a primary or
28-
standby, has fully started.
28+
standby, has started up.
2929

3030
:::info
3131
By default, the startup probe uses
@@ -34,6 +34,14 @@ standby, has fully started.
3434
strategy.
3535
:::
3636

37+
With the default `pg_isready` strategy, an instance is considered started as
38+
soon as PostgreSQL is alive, even if it is still rejecting connections while
39+
it completes its startup sequence (for example, a standby performing crash
40+
recovery or replaying WAL). This prevents the kubelet from repeatedly
41+
restarting an instance that is legitimately recovering. The instance remains
42+
unready, and therefore excluded from the ready endpoints of the services,
43+
until the readiness probe reports that it accepts connections.
44+
3745
While the startup probe is running, the liveness and readiness probes remain
3846
disabled. Following Kubernetes standards, if the startup probe fails, the
3947
kubelet will terminate the container, which will then be restarted.
@@ -42,13 +50,15 @@ The `.spec.startDelay` parameter specifies the maximum time, in seconds,
4250
allowed for the startup probe to succeed.
4351

4452
By default, the `startDelay` is set to `3600` seconds. It is recommended to
45-
adjust this setting based on the time PostgreSQL needs to fully initialize in
46-
your specific environment.
53+
adjust this setting based on the time PostgreSQL needs to start in your
54+
specific environment. With the default `pg_isready` strategy, this only
55+
needs to cover the time required for the postmaster to come alive, while
56+
with the `query` and `streaming` strategies it must also account for the
57+
time needed to complete recovery and accept connections.
4758

4859
:::warning
49-
Setting `.spec.startDelay` too low can cause the liveness probe to activate
50-
prematurely, potentially resulting in unnecessary Pod restarts if PostgreSQL
51-
hasn’t fully initialized.
60+
Setting `.spec.startDelay` too low can cause the startup probe to fail
61+
before PostgreSQL has started up, resulting in unnecessary Pod restarts.
5262
:::
5363

5464
CloudNativePG configures the startup probe with the following default parameters:
@@ -105,8 +115,11 @@ To accommodate these requirements, CloudNativePG extends the
105115
- `type`: specifies the criteria for considering the probe successful. Accepted
106116
values, in increasing order of complexity/depth, include:
107117

108-
- `pg_isready`: marks the probe as successful when the `pg_isready` command
109-
exits with `0`. This is the default for primary instances and replicas.
118+
- `pg_isready`: relies on the exit code of the `pg_isready` command. The
119+
startup probe is successful when the server is either accepting
120+
connections or alive but rejecting them, as described above. The
121+
readiness probe is successful only when the server is accepting
122+
connections. This is the default for primary instances and replicas.
110123
- `query`: marks the probe as successful when a basic query is executed on
111124
the `postgres` database locally.
112125
- `streaming`: marks the probe as successful when the replica begins
@@ -143,6 +156,14 @@ probes:
143156
maximumLag: 16Mi
144157
```
145158

159+
:::info
160+
The `query` and `streaming` strategies require PostgreSQL to accept
161+
connections, so a startup probe using them keeps failing while an
162+
instance replays WAL after a crash. When using these strategies, make
163+
sure that `startDelay` (or your custom `failureThreshold`) allows enough
164+
time for recovery to complete.
165+
:::
166+
146167
## Liveness Probe
147168

148169
The liveness probe begins after the startup probe successfully completes. Its

0 commit comments

Comments
 (0)