kbst / mongodb

MongoDB Operator for Kubernetes

Home Page:https://www.kubestack.com/catalog/mongodb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't execute mongo command

kentinchen opened this issue · comments

  1. kubectl apply -f https://api.kubestack.com/v1/manifest/bec3141
  2. kubectl -n default exec -ti mongo-plum-reptilia-0 -c mongod
    -- mongo --host localhost --ssl
    --sslCAFile /etc/ssl/mongod/ca.pem
    --sslPEMKeyFile /etc/ssl/mongod/mongod.pem
    MongoDB shell version v3.6.4
    connecting to: mongodb://localhost:27017/
    MongoDB server version: 3.6.4
  1. show dbs
    2018-10-02T02:54:38.723+0000 E QUERY [thread1] Error: listDatabases failed:{
    "ok" : 0,
    "errmsg" : "not authorized on admin to execute command { listDatabases: 1.0, $db: "admin" }",
    "code" : 13,
    "codeName" : "Unauthorized"
    } :
    _getErrorWithCode@src/mongo/shell/utils.js:25:13
    Mongo.prototype.getDBs@src/mongo/shell/mongo.js:65:1
    shellHelper.show@src/mongo/shell/utils.js:820:19
    shellHelper@src/mongo/shell/utils.js:710:15
    @(shellhelp2):1:1

use db.auth('root','get password from k8s security config map')