Hi Folks
I have gotten my app running with Docker and all works well.
I have now attempted to put it in kubernetes and experiencing problems to understand how to do this.
When I use docker I can connect with mongosh using the host name passed
docker run -d --rm --name mongo -p 27017:27017 -v mongodata -e MONGO_INITDB_ROOT_USERNAME=forshow -e MONGO_INITDB_ROOT_PASSWORD=forshow --network restapicsharp mongo
And in this case I can connect with the user/password and the name of the container (mongo) and all works well.
For Kubernetes I am instructed to use the service-name and Cluster :None and the forums say do not command.
If I use mongo client I can connect to the kubernetes service as long as I do not use the user/password
mongosh mongodb://mongodb-service:27017
if I try with the username/password
mongosh mongodb://forshow:forshow@mongodb-service:27017
It fails with MongoServerError: Authentication failed.
And of course "UserNotFound: Could not find user …
I do specify the user and password
env:
- name: MONOGO_INITDB_ROOT_USERNAME
value: "forshow"
- name: MONOGO_INITDB_ROOT_PASSWORD
value: forshow
And as I say with no credentials it does work.
Thanks all