Skip to content

Commit 06e6a85

Browse files
authored
Merge pull request #6 from renatomefi/docs/improve
Document Kubernetes php-fpm probes examples
2 parents bc46635 + a9a1e39 commit 06e6a85

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,42 @@ $ echo $?
9999
0
100100
```
101101

102+
## Kubernetes example
103+
104+
More and more people are looking for health checks on kubernetes for php-fpm, here is an example of livenessProbe and readinessProbe:
105+
106+
### livenessProbe
107+
108+
```yaml
109+
# PodSpec: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#podspec-v1-core
110+
spec:
111+
containers:
112+
- name: "php-fpm"
113+
livenessProbe:
114+
exec:
115+
command:
116+
- php-fpm-healthcheck
117+
- --listen-queue-len=10 # fails if there are more than 10 processes waiting in the fpm queue
118+
- --accepted-conn=5000 # fails after fpm has served more than 5k requests, this will force the pod to reset, use with caution
119+
initialDelaySeconds: 0
120+
periodSeconds: 10
121+
```
122+
123+
### readinessProbe
124+
125+
```yaml
126+
# PodSpec: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#podspec-v1-core
127+
spec:
128+
containers:
129+
- name: "php-fpm"
130+
readinessProbe:
131+
exec:
132+
command:
133+
- php-fpm-healthcheck # a simple ping since this means it's ready to handle traffic
134+
initialDelaySeconds: 1
135+
periodSeconds: 5
136+
```
137+
102138
## Why POSIX sh
103139
104140
Most of the containers contain limited software installed, using POSIX sh aims to be compatible with most of the OS images around.

0 commit comments

Comments
 (0)