Skip to content

Commit

Permalink
refactor: Update startupProbe and readinessProbe configuration in Kub…
Browse files Browse the repository at this point in the history
…ernetes introduction
  • Loading branch information
Pradumnasaraf committed Sep 18, 2024
1 parent 7359067 commit 5cb220c
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions docs/kubernetes/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,19 @@ spec:

Probes are used to check the health of the container. There are three types of probes:

- **Liveness Probe**: It is used to check if the container is alive. If the liveness probe fails, the container will be restarted. Sometimes deadlocks can occur in the container, so the liveness probe is used to check if the container is alive.
- **Startup Probe**: It is used to check if the container is started. It is used to delay the liveness and readiness probes until the container is started.
- **Readiness Probe**: It is used to check if the container is ready to serve traffic. If the readiness probe fails, the container will not receive traffic. It is used to delay the traffic until the container is ready.
- **Startup Probe**: It is used to check if the container is ready to start accepting traffic. It is used to delay the traffic until the container is ready to accept traffic.
- **Liveness Probe**: It is used to check is in healthy state and able to serve traffic. If the liveness probe fails, the container will be restarted. It is used to restart the container if it is in an unhealthy state.

#### Liveness Probe
#### Startup Probe

```yaml
livenessProbe:
startupProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 3 # Wait for 3 seconds before starting the probe
periodSeconds: 3 # Check every 3 seconds
failureThreshold: 30
periodSeconds: 10
```

#### Readiness Probe
Expand All @@ -191,27 +191,36 @@ readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 3
periodSeconds: 3
initialDelaySeconds: 3 # Wait for 3 seconds before starting the probe
periodSeconds: 3 # Check every 3 seconds
timeoutSeconds: 5 # Wait for 5 seconds before considering the probe as failed
successThreshold: 1 # Mark the probe as successful after 1 success
failureThreshold: 2 # Mark the probe as failed after 2 failures
---
readinessProbe:
exec:
command:
- cat
- /tmp/healthy
initialDelaySeconds: 5
periodSeconds: 5
initialDelaySeconds: 3 # Wait for 3 seconds before starting the probe
periodSeconds: 3 # Check every 3 seconds
timeoutSeconds: 5 # Wait for 5 seconds before considering the probe as failed
successThreshold: 1 # Mark the probe as successful after 1 success
failureThreshold: 2 # Mark the probe as failed after 2 failures
```

#### Startup Probe
#### Liveness Probe

```yaml
startupProbe:
livenessProbe:
httpGet:
path: /health
port: 8080
failureThreshold: 30
periodSeconds: 10
initialDelaySeconds: 3 # Wait for 3 seconds before starting the probe
periodSeconds: 3 # Check every 3 seconds
timeoutSeconds: 5 # Wait for 5 seconds before considering the probe as failed
successThreshold: 1 # Mark the probe as successful after 1 success
failureThreshold: 2 # Mark the probe as failed after 2 failures
```

### Pod Lifecycle
Expand Down

0 comments on commit 5cb220c

Please sign in to comment.