Skip to content

STS: Mongodb goes into CrashLoopBackOff #197

Closed

Description

Describe the bug

I installed the app using aks-store-all-in-one.yaml config but the mongodb pod goes into CrashLoopBackOff because its liveness probe fails. Liveness check is failing with the following error:

pets 0s Warning Unhealthy pod/mongodb-0 Liveness probe failed: OCI runtime exec failed: exec failed: unable to start container process: exec: "mongosh": executable file not found in $PATH: unknown

To Reproduce
Steps to reproduce the behavior:

  1. Follow steps from: https://github.com/Azure-Samples/aks-store-demo/tree/main?tab=readme-ov-file#run-on-any-kubernetes i.e.:
kubectl create ns pets

kubectl apply -f https://raw.githubusercontent.com/Azure-Samples/aks-store-demo/main/aks-store-all-in-one.yaml -n pets
  1. Run the following to see that the mongodb-0 pod keeps restarting:
kubectl get events -w -n pets

Expected behavior

Pod should pass the liveness probe.

Source of the error

exec:
command:
- mongosh
- --eval
- db.runCommand('ping').ok

Activity

  1. pauldotyu commented on Feb 12, 2025

    @pauldotyu
    Contributor

    Suraj Deshmukh (@surajssd) what type of kubernetes cluster were you running this on?

  2. surajssd commented on Feb 13, 2025

    @surajssd
    Author

    Paul Yu (@pauldotyu) I was using Minikube.

    But this seems like an issue regardless of the k8s kind. This looks like a container image issue.

  3. ITOpenwork commented on Mar 12, 2025

    @ITOpenwork

    The following settings seem to work good in minikube:

            livenessProbe:
              exec:
                command:
                - mongosh
                - --eval
                - db.runCommand('ping').ok
              initialDelaySeconds: 30
              periodSeconds: 20
              timeoutSeconds: 10
              failureThreshold: 6
              successThreshold: 1
    
  4. kszicsillag commented on Oct 8, 2025

    @kszicsillag

    But the original error message looks valid: it seems that the image (mcr.microsoft.com/mirror/docker/library/mongo:4.2) referenced in the linked yaml does not contain the mongosh tool (only mongo CLI).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions