Closed moule3053 closed 2 years ago
Please note you can't use MongoDB
as the release name since it is not a valid string (due to the uppercases):
$ helm install MongoDB --set image.debug=true,mongodbRootPassword=secretpassword,replicaSetKey=seplicasetkey bitnami/mongodb-sharded --namespace mongodb --create-namespace
Error: INSTALLATION FAILED: create: failed to create: Secret "sh.helm.release.v1.MongoDB.v1" is invalid: metadata.name: Invalid value: "sh.helm.release.v1.MongoDB.v1": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
Converting it to lowercase everything works fine:
$ helm install mongodb --set image.debug=true,mongodbRootPassword=secretpassword,replicaSetKey=seplicasetkey bitnami/mongodb-sharded --namespace mongodb --create-namespace
NAME: mongodb
LAST DEPLOYED: Sun Oct 17 05:49:34 2021
NAMESPACE: mongodb
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
** Please be patient while the chart is being deployed **
The MongoDB® Sharded cluster can be accessed via the Mongos instances in port 27017 on the following DNS name from within your cluster:
mongodb-mongodb-sharded.mongodb.svc.cluster.local
To get the root password run:
export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace mongodb mongodb-mongodb-sharded -o jsonpath="{.data.mongodb-root-password}" | base64 --decode)
To connect to your database run the following command:
kubectl run --namespace mongodb mongodb-mongodb-sharded-client --rm --tty -i --restart='Never' --image docker.io/bitnami/mongodb-sharded:4.4.10-debian-10-r0 --command -- mongo admin --host mongodb-mongodb-sharded
To connect to your database from outside the cluster execute the following commands:
kubectl port-forward --namespace mongodb svc/mongodb-mongodb-sharded 27017:27017 &
mongo --host 127.0.0.1 --authenticationDatabase admin -p $MONGODB_ROOT_PASSWORD
$ helm ls -n mongodb
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
mongodb mongodb 1 2021-10-17 05:49:34.617708656 +0000 UTC deployed mongodb-sharded-3.9.10 4.4.10
$ kubectl get pods -n mongodb
NAME READY STATUS RESTARTS AGE
mongodb-mongodb-sharded-configsvr-0 1/1 Running 0 2m29s
mongodb-mongodb-sharded-mongos-68bbbd44d6-dv6cj 1/1 Running 0 2m29s
mongodb-mongodb-sharded-shard0-data-0 1/1 Running 0 2m29s
mongodb-mongodb-sharded-shard1-data-0 1/1 Running 0 2m29s
$ kubectl logs mongodb-mongodb-sharded-mongos-68bbbd44d6-dv6cj -n mongodb
mongodb 05:49:57.30 Welcome to the Bitnami mongodb-sharded container
mongodb 05:49:57.30 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mongodb-sharded
mongodb 05:49:57.30 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mongodb-sharded/issues
mongodb 05:49:57.31 INFO ==> ** Starting MongoDB Sharded setup **
mongodb 05:49:57.37 INFO ==> Validating settings in MONGODB_* env vars...
mongodb 05:49:57.62 INFO ==> Initializing Mongos...
mongodb 05:49:57.62 INFO ==> Writing keyfile for replica set authentication...
mongodb 05:49:57.73 DEBUG ==> Waiting for primary node...
mongodb 05:49:57.73 DEBUG ==> Waiting for primary node...
mongodb 05:49:57.74 INFO ==> Trying to connect to MongoDB server mongodb-mongodb-sharded-configsvr-0.mongodb-mongodb-sharded-headless.mongodb.svc.cluster.local...
cannot resolve host "mongodb-mongodb-sharded-configsvr-0.mongodb-mongodb-sharded-headless.mongodb.svc.cluster.local": lookup mongodb-mongodb-sharded-configsvr-0.mongodb-mongodb-sharded-headless.mongodb.svc.cluster.local: no such host
...
cannot resolve host "mongodb-mongodb-sharded-configsvr-0.mongodb-mongodb-sharded-headless.mongodb.svc.cluster.local": lookup mongodb-mongodb-sharded-configsvr-0.mongodb-mongodb-sharded-headless.mongodb.svc.cluster.local: no such host
mongodb 05:51:08.44 INFO ==> Found MongoDB server listening at mongodb-mongodb-sharded-configsvr-0.mongodb-mongodb-sharded-headless.mongodb.svc.cluster.local:27017 !
mongodb 05:51:08.85 INFO ==> MongoDB server listening and working at mongodb-mongodb-sharded-configsvr-0.mongodb-mongodb-sharded-headless.mongodb.svc.cluster.local:27017 !
mongodb 05:51:08.85 DEBUG ==> Waiting for primary host mongodb-mongodb-sharded-configsvr-0.mongodb-mongodb-sharded-headless.mongodb.svc.cluster.local to be ready...
mongodb 05:51:08.86 DEBUG ==> Validating mongodb-mongodb-sharded-configsvr-0.mongodb-mongodb-sharded-headless.mongodb.svc.cluster.local as primary node...
mongodb 05:51:09.03 INFO ==> Primary node ready.
mongodb 05:51:09.05 INFO ==> ** MongoDB Sharded setup finished! **
mongodb 05:51:09.11 INFO ==> ** Starting MongoDB **
{"t":{"$date":"2021-10-17T05:51:09.145Z"},"s":"W", "c":"SHARDING", "id":24132, "ctx":"main","msg":"Running a sharded cluster with fewer than 3 config servers should only be done for testing purposes and is not recommended for production."}
In the above example I used the same command but using lowercases in the release name and everything is working without any issue.
The
cannot resolve host "mongodb-mongodb-sharded-configsvr-0.mongodb-mongodb-sharded-headless.mongodb.svc.cluster.local": lookup mongodb-mongodb-sharded-configsvr-0.mongodb-mongodb-sharded-headless.mongodb.svc.cluster.local: no such host
error appeared in the mongos pod while it is trying to connect to other pods, but it is something normal. The container is trying to connect to another container that is being created, once created the connection succeeds and the deployment continues without any issues.
If in your case the deployment doesn't continue after a while, please check if you installed it previously with the same name or namespace but a different password (or without a password, where a random one is autogenerated). If that is the case, there can be a discrepancy between the password from the previous deployment and this one. In that case, please try removing the PV/PVCs and deploying it from scratch (using a different namespace if possible)
This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.
Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.
Which chart:
bitnami/mongodb-sharded
Describe the bug After running the helm chart on Kubernetes, I get the error
from the
mongos
podTo Reproduce Steps to reproduce the behavior:
mongos
podExpected behavior Start without error.
Helm and Kubernetes version
helm version
:kubectl version
: