Mongodb connection error when exec in kubernetes pod

2/3/2020

I have deployed mongodb using Helm chart with following values:

mongodb:
  mongodbUsername: mongo_user
  mongodbPassword: verylongpassword
  mongodbDatabase: mongo_read_db
  replicaCount: 1

But when I exec into the pod by:

kubectl exec -it pod sh

And give $mongo command, I get the following error

$ mongo
MongoDB shell version v4.2.2
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("5d2a9b35d-4ef1-4eeeb0-8fee2-ac9974e7ee66a") }
MongoDB server version: 4.2.2
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
    http://docs.mongodb.org/
Questions? Try the support group
    http://groups.google.com/group/mongodb-user
2020-02-03T13:29:07.716+0000 I  STORAGE  [main] In File::open(), ::open for '//.mongorc.js' failed with Permission denied

I tried this after I am unable to connect from rails app.

-- Tek Nath
kubernetes
kubernetes-helm
mongodb

0 Answers