From 5cb220cca430ec282a40ae9eb4dfe58e68045e57 Mon Sep 17 00:00:00 2001 From: Pradumna Saraf Date: Wed, 18 Sep 2024 12:21:45 +0530 Subject: [PATCH] refactor: Update startupProbe and readinessProbe configuration in Kubernetes introduction --- docs/kubernetes/introduction.md | 37 ++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/docs/kubernetes/introduction.md b/docs/kubernetes/introduction.md index a826258..1692828 100644 --- a/docs/kubernetes/introduction.md +++ b/docs/kubernetes/introduction.md @@ -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 @@ -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