Skip to content

Commit d742034

Browse files
authored
Add liveness probe for MongoDB container (#1784)
This will allow k8s to reboot the pod if MongoDB becomes unresponsive.
1 parent a333837 commit d742034

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docker/deployment/db-deployment.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ spec:
5151
- name: db
5252
image: mongo:6
5353
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers
54+
livenessProbe:
55+
exec:
56+
command:
57+
- mongosh
58+
- '--quiet'
59+
- '--eval'
60+
- db.runCommand('ping')
61+
failureThreshold: 3
62+
initialDelaySeconds: 30
63+
periodSeconds: 10
64+
successThreshold: 1
65+
timeoutSeconds: 5
5466
resources:
5567
requests:
5668
memory: 260Mi

0 commit comments

Comments
 (0)