Unable to connect with mongodb from internal kubernetes cluster

9/25/2019

I tried setting up mongodb via bitnami stable/mongodb helm chart, the helm chart installation command is as follows -

helm install --name mongo --set mongodbRootPassword=mongo,mongodbUsername=mongo,mongodbPassword=mongo,mongodbDatabase=database stable/mongodb

after creation of it, I am looking to connect my applications by following format of connection string

mongodb://[user]:[password]@[service].[namespace].svc.cluster.local:27017/[db]?replicaSet=rs0&authSource=admin

But I am getting error for this -

failed to connect to server [mongo.shift-resourcing.svc.cluster.local:27017] on first connect [MongoNetworkError: Client network socket disconnected before secure TLS connection was established]

The mongod.conf file is as follows -

# where and how to store data.
   storage:
      dbPath: /bitnami/mongodb/data/db
      journal:
       enabled: true
      directoryPerDB: false
    # where to write logging data.
    systemLog:
      destination: file
      quiet: false
      logAppend: true
      logRotate: reopen
      path: /opt/bitnami/mongodb/logs/mongodb.log
      verbosity: 0
     # network interfaces
    net:
      port: 27017
      unixDomainSocket:
        enabled: true
        pathPrefix: /opt/bitnami/mongodb/tmp
      ipv6: false
      bindIpAll: true
    # replica set options
    #replication:
      #replSetName: replicaset
      #enableMajorityReadConcern: true
    # process management options
    processManagement:
       fork: false
       pidFilePath: /opt/bitnami/mongodb/tmp/mongodb.pid
    # set parameter options
    setParameter:
       enableLocalhostAuthBypass: false
    # security options
    security:
      authorization: enabled
      #keyFile: replace_me
-- Tushar Mahajan
azure
azure-kubernetes
mongodb

0 Answers