Hello,
I bashed into the mongo router pod and used the connection string to obtain the mongo shell and was able to access admin db
****** REPLACED ORIGINAL USERNAME & PASSWORD *****
root@nexus-config-mongo-cluster-router-node1-rc-fcwnj:/# mongo --verbose mongodb://nexus-global-admin-user:<password>@mongo-cluster-router-node1-svc.cluster.local:27017/admin?authMechanism=SCRAM-SHA-1
MongoDB shell version v4.2.2
connecting to: mongodb://nexus-config-mongo-cluster-router-node1-svc.nexusdash.svc.cluster.local:27017/admin?authMechanism=SCRAM-SHA-1&compressors=disabled&gssapiServiceName=mongodb
2023-03-16T18:27:46.128+0000 D1 NETWORK [js] creating new connection to:mongo-cluster-router-node1-svc.cluster.local:27017
2023-03-16T18:27:46.134+0000 D1 NETWORK [js] connected to server mongo-cluster-router-node1-svc.cluster.local:27017
2023-03-16T18:27:46.134+0000 D1 NETWORK [js] connected connection!
Implicit session: session { "id" : UUID("9de4c2a0-a279-4f9c-ac1e-bd3ff99051ce") }
MongoDB server version: 4.2.2
mongos>
mongos>
mongos> show dbs
Global-aegis 0.001GB
Global-griffin 0.001GB
Global-sorcerer 0.002GB
Global-spartan 0.002GB
admin 0.000GB
config 0.002GB
nexusdash-ndi 3.324GB
nexusdash-sitehub 0.000GB
nexusdash-thanos 0.000GB
mongos> use admin
switched to db admin
mongos>
mongos>
mongos>
mongos> show collections
system.users
system.version
mongos> db.system.users.find()
{ "_id" : "admin.nexus-global …
…
…
but while configuring the same mongo connection with vault, I’m getting below error
root@vault-0-0:/# vault write database/config/nexus_config_mongodb \
plugin_name=mongodb-database-plugin \
allowed_roles="test-mongodb-nexusdash-aquarius-readwrite" \
connection_url="mongodb://{{username}}:{{password}}@mongo-cluster-router-node1-svc.cluster.local:27017/admin?authMechanism=SCRAM-SHA-1" \
username="nexus-global-admin-user****" \
password="replaced with password" \
username_template="{{.RoleName}}-user"
Error writing data to database/config/nexus_config_mongodb: Error making API request.
URL: PUT https://vault-0.default.svc.cluster.local:8200/v1/database/config/nexus_config_mongodb
Code: 400. Errors:
* error creating database object: failed to verify connection: connection() error occured during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.
Any idea what might be going on here ? Appreciate any help regarding this.
Rgds,
Anish