是否需要帮助?
是的
我要做什么?
我试图在启用了副本集的主图表中将稳定/ mongodb用作子图表
执行的步骤
dependencies:
- name: mongodb
version: "5.17.0"
repository: "file://charts/mongodb"
mongodb:
usePassword: true
existingSecret: skeleton
mongodbUsername: skeleton
mongodbDatabase: skeleton
replicaSet:
## Whether to create a MongoDB replica set for high availability or not
enabled: true
useHostnames: true
name: rs0
replicas:
secondary: 1
arbiter: 1
-为此定义秘密 为骨骼秘密
apiVersion: v1
kind: Secret
metadata:
name: skeleton
type: Opaque
data:
# mongo ha---
mongodb-root-password: <64-bit-encoded-root-password>
mongodb-replica-set-key: <64-bit-encoded-Key>
mongodb-password: <64-bit-encoded-password>
-在deployment.yaml中提供了无头服务网址mongodb网址以连接到该网址
来自同一k8s集群中托管的应用程序
mongodb://<mongodbUsername-value-define-in-value.yaml>:<mongodb-password-value-present-in-secret>@skeleton-mongodb-headless:27017/skeleton?authSource=admin&replicaSet=rs0
[1;30m2019-05-07 05:06:16,085[0;39m => [34mINFO [0;39m [[32mmain[0;39m] [33mcom.mongodb.diagnostics.logging.SLF4JLogger[0;39m: Cluster created with settings {hosts=[skeleton-mongodb-headless:27017], mode=MULTIPLE, requiredClusterType=REPLICA_SET, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500, requiredReplicaSetName='rs0'}
[1;30m2019-05-07 05:06:16,085[0;39m => [34mINFO [0;39m [[32mmain[0;39m] [33mcom.mongodb.diagnostics.logging.SLF4JLogger[0;39m: Adding discovered server skeleton-mongodb-headless:27017 to client view of cluster
[1;30m2019-05-07 05:06:16,175[0;39m => [34mINFO [0;39m [[32mmain[0;39m] [33mcom.mongodb.diagnostics.logging.SLF4JLogger[0;39m: No server chosen by com.mongodb.Mongo$4@359ff4d9 from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=skeleton-mongodb-headless:27017, type=UNKNOWN, state=CONNECTING}]}. Waiting for 30000 ms before timing out
[1;30m2019-05-07 05:06:16,182[0;39m => [34mINFO [0;39m [[32mcluster-ClusterId{value='5cd11248b2cfc400017b5805', description='null'}-skeleton-mongodb-headless:27017[0;39m] [33mcom.mongodb.diagnostics.logging.SLF4JLogger[0;39m: Exception in monitor thread while connecting to server skeleton-mongodb-headless:27017
com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='skeleton', source='admin', password=<hidden>, mechanismProperties={}}
at com.mongodb.connection.SaslAuthenticator.wrapException(SaslAuthenticator.java:162)
at com.mongodb.connection.SaslAuthenticator.access$200(SaslAuthenticator.java:39)
at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:68)
at com.mongodb.connection.SaslAuthenticator$1.run(SaslAuthenticator.java:46)
at com.mongodb.connection.SaslAuthenticator.doAsSubject(SaslAuthenticator.java:168)
at com.mongodb.connection.SaslAuthenticator.authenticate(SaslAuthenticator.java:46)
查询
答案 0 :(得分:1)
删除pv和Azure磁盘后,我可以解决此问题以进行身份验证。 我还使用了 release-name-mongodb 而不是 release-name-mongodb-headless