by Deploying the Mongodb Helm Chart of Bitnami to openshift, i got the Error "Readiness Probe failed"
the Health Check setting for Readiness and liveness Probe is looking like this
livenessProbe:
failureThreshold: 6
initialDelaySeconds: 30
periodSeconds: 20
successThreshold: 1
timeoutSeconds: 10
exec:
command:
- /bitnami/scripts/ping-mongodb.sh
readinessProbe:
failureThreshold: 6
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
exec:
command:
- /bitnami/scripts/readiness-probe.sh
the scripts calling by the Command (/bitnami/scripts/readiness-probe.sh) is looking like this
#!/bin/bash
# Run the proper check depending on the version
[[ $(mongod -version | grep "db version") =~ ([0-9]+\.[0-9]+\.[0-9]+) ]] && VERSION=${BASH_REMATCH[1]}
. /opt/bitnami/scripts/libversion.sh
VERSION_MAJOR="$(get_sematic_version "$VERSION" 1)"
VERSION_MINOR="$(get_sematic_version "$VERSION" 2)"
VERSION_PATCH="$(get_sematic_version "$VERSION" 3)"
if [[ ( "$VERSION_MAJOR" -ge 5 ) || ( "$VERSION_MAJOR" -ge 4 && "$VERSION_MINOR" -ge 4 && "$VERSION_PATCH" -ge 2 ) ]]; then
mongosh $TLS_OPTIONS --port $MONGODB_PORT_NUMBER --eval 'db.hello().isWritablePrimary || db.hello().secondary' | grep -q 'true'
else
mongosh $TLS_OPTIONS --port $MONGODB_PORT_NUMBER --eval 'db.isMaster().ismaster || db.isMaster().secondary' | grep -q 'true'
fi
By running this script, the Pod becomes very slow. No matter how high I set the time for Readiness probe, it doesn't work.
i check if the script are existing in the running Pod --> there are the file /bitnami/scripts/readiness-probe.sh existing in the Pod
i change the Command running the script to just " cat /bitnami/scripts/readiness-probe.sh" in readiness probe setting --> IT WORKING
livenessProbe: failureThreshold: 6 initialDelaySeconds: 30 periodSeconds: 20 successThreshold: 1 timeoutSeconds: 10 exec: command: - cat - /bitnami/scripts/ping-mongodb.sh readinessProbe: failureThreshold: 6 initialDelaySeconds: 5 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 exec: command: - cat - /bitnami/scripts/readiness-probe.sh
i increase the CPU and memory --> NOT Success!
I have noticed that the Pod becomes very slow as soon as a Mongodb command is executed.