Skip to content

Instantly share code, notes, and snippets.

@fenar
Created March 31, 2023 15:17
Show Gist options
  • Save fenar/b90e48904fd48d88dbaa28a76c99e076 to your computer and use it in GitHub Desktop.
Save fenar/b90e48904fd48d88dbaa28a76c99e076 to your computer and use it in GitHub Desktop.
WebServerLivenessCheck
Here's an example of a liveness probe that checks if Apache is able to handle incoming web traffic on an OpenShift container:
---
apiVersion: v1
kind: Pod
metadata:
name: my-apache-pod
spec:
containers:
- name: apache
image: httpd:2.4
ports:
- containerPort: 80
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 30
periodSeconds: 10
failureThreshold: 3
timeoutSeconds: 1
---
This liveness probe is configured to perform an HTTP GET request to the root URL path of the Apache web server on port 80 every 10 seconds, with an initial delay of 30 seconds. If the probe fails three times in a row, with a timeout of 1 second each time, the container will be considered as failed and OpenShift will automatically restart the container.
If Apache is not able to handle incoming web traffic, the HTTP GET request will fail and the liveness probe will detect the failure, triggering a container restart. This helps ensure that your Apache web server is always available and able to handle incoming traffic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment