MongoServerError: Authentication failed when trying to connect via mongosh

Inside AKS Cluster:

kubectl get pods
NAME READY STATUS RESTARTS AGE
mongodb-5b8d4fc596-XXXXXX 2/1 Running 0 126m

Installed by:

helm upgrade mongodb bitnami/mongodb
–install
–create-namespace
–namespace mongodb \

export MONGODB_ROOT_PASSWORD=$(kubectl get secret
–namespace mongodb mongodb
-o jsonpath=“{.data.mongodb-root-password}” | base64 -d)

kubectl run
–namespace mongodb mongodb-client
–rm --tty -i
–restart=‘Never’
–env=“MONGODB_ROOT_PASSWORD=$MONGODB_ROOT_PASSWORD”
–image Docker: Accelerated, Containerized Application Development
–command
– bash

Inside pod:

mongosh admin --host “mongodb” --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD

Why this is failing with the following?

Current Mongosh Log ID: 63c7362a08XXXXXXXXX
Connecting to: mongodb://@mongodb:27017/admin?directConnection=true&authSource=admin&appName=mongosh+1.6.2
MongoNetworkError: connect ECONNREFUSED 172.16.147.83:27017

It was working yesterday? I am simply following the output instructions, but did notice yesterday the image was

–image Docker: Accelerated, Containerized Application Developmentr9

now

–image Docker: Accelerated, Containerized Application Developmentr20

This shouldn’t affect how it is connected internally within the AKS clusters?

helm version
version.BuildInfo{Version:“v3.10.3”

kubectl version --client --short
Client Version: v1.24.0
Kustomize Version: v4.5.4

Hi Sebastian,

I see that you have connection refused. Please confirm the following:

  1. When did you installed the pod with MongoDB?
  2. The IP address of pod? Does it changes every time you restart the pod?

Regards,
Janpreet