3

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.

  1. i check if the script are existing in the running Pod --> there are the file /bitnami/scripts/readiness-probe.sh existing in the Pod

  2. 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
    
  3. i increase the CPU and memory --> NOT Success!

  4. I have noticed that the Pod becomes very slow as soon as a Mongodb command is executed.

NMV
  • 31
  • 1
  • 2

1 Answers1

0

I had the same problem and saw that there was not enough timeoutSeconds

readinessProbe:
  timeoutSeconds: 5

in the deployment, so I increased the timeout time to 20 and the error went away. Idk, how many resourses it needs to work stable(

koala1101
  • 1
  • 1