Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

[stable/mongodb] Not working without password #16450

Closed
shield-9 opened this issue Aug 20, 2019 · 12 comments
Closed

[stable/mongodb] Not working without password #16450

shield-9 opened this issue Aug 20, 2019 · 12 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@shield-9
Copy link

Describe the bug
When usePassword is set to false, mongodb-primary-0 fails to start.

Version of Helm and Kubernetes:

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.2", GitCommit:"f6278300bebbb750328ac16ee6dd3aa7d3549568", GitTreeState:"clean", BuildDate:"2019-08-05T09:23:26Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13+", GitVersion:"v1.13.5-ca", GitCommit:"2166946f41b36dea2c4626f90a77706f426cdea2", GitTreeState:"dirty", BuildDate:"2019-03-29T02:08:05Z", GoVersion:"go1.11.1", Compiler:"gc", Platform:"linux/amd64"}
$ helm version
Client: &version.Version{SemVer:"v2.14.3", GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.14.0", GitCommit:"05811b84a3f93603dd6c2fcfe57944dfa7ab7fd0", GitTreeState:"clean"}

Which chart:
stable/mongodb (5.20.3 or later)

What happened:

$ kubectl logs demo-mongodb-primary-0 mongodb-primary
Welcome to the Bitnami mongodb container
Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mongodb
Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mongodb/issues
Send us your feedback at containers@bitnami.com
INFO  ==> ** Starting MongoDB setup **
INFO  ==> Validating settings in MONGODB_* env vars...
ERROR ==> MONGODB_ROOT_PASSWORD have to be set on a 'primary' node!

What you expected to happen:
When usePassword is set to false, mongodb-primary-0 start without problem.

How to reproduce it (as minimally and precisely as possible):
My values.yaml is:

replicaSet:
  enabled: true
metrics:
  enabled: true
livenessProbe:
  enbaled: true
readinessProbe:
  enabled: true
usePassword: false
@miguelaeh
Copy link
Collaborator

miguelaeh commented Aug 20, 2019

Hi @shield-9 ,
I tried to reproduce the issue but in my case I cannot get that error. I installed the Chart using:

$ helm install stable/mongodb -n mongodb --set usePassword=false

Also I tried with a normal deployment and both work as expected.
Could you try that command? If it doesn't work, could you try to clean your environment and execute the command again? Remove things such as PVC and so on that are not removed with the --purge option on the helm delete.
Also, I see your values.yaml has a typo:

livenessProbe:
  enbaled: true <-- this should be enabled: true

@shield-9
Copy link
Author

shield-9 commented Aug 21, 2019

Could you try this?
helm install stable/mongodb -n mongodb --set usePassword=false --set replicaSet.enabled=true

Also, I see your values.yaml has a typo:

Oops, thank you! It is my mistake while creating example YAML.

@alec-benson
Copy link

alec-benson commented Sep 5, 2019

Hi @shield-9 ,
I tried to reproduce the issue but in my case I cannot get that error. I installed the Chart using:

$ helm install stable/mongodb -n mongodb --set usePassword=false

Also I tried with a normal deployment and both work as expected.
Could you try that command? If it doesn't work, could you try to clean your environment and execute the command again? Remove things such as PVC and so on that are not removed with the --purge option on the helm delete.
Also, I see your values.yaml has a typo:

livenessProbe:
  enbaled: true <-- this should be enabled: true

I am seeing the same problem. Using the helm command you suggested the primary fails to spin up and I see MONGODB_ROOT_PASSWORD have to be set on a 'primary' node! in the logs. I'm currently using version 7.2.7 of the chart.

I think this issue may be related https://github.com/bitnami/bitnami-docker-mongodb/issues/151

For now, I am using an earlier version of the bitnami mongo image (4.0.10-debian-9-r22) and it is working again.

@stale
Copy link

stale bot commented Oct 5, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

@stale stale bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 5, 2019
@stale
Copy link

stale bot commented Oct 19, 2019

This issue is being automatically closed due to inactivity.

@stale stale bot closed this as completed Oct 19, 2019
@davide-talesco
Copy link

davide-talesco commented Oct 24, 2019

helm install stable/mongodb -n mongodb --set usePassword=false --set replicaSet.enabled=true --set persistence.enabled=false

does not work with stable/mongodb 7.4.2 4.0.13 . I get

ERROR ==> MONGODB_ROOT_PASSWORD have to be set on a 'primary' node!

@shield-9
Copy link
Author

@davide-talesco I'm using modified container image to avoid this issue.
https://gist.github.com/shield-9/4ae1abd55efb9314b554b2692df948de

@jwalton
Copy link

jwalton commented Oct 24, 2019

One workaround is to set replicaSet.enabled=false (which is obviously a slightly lame workaround, because you don't have a replica set anymore).

The other is, obviously to set usePassword: true (which is obviously also a lame workaround).

@jwalton
Copy link

jwalton commented Nov 8, 2019

I've found another awful way around this. :P It seems the issue isn't actually with the helm chart, but with the bitnami mongodb image. If you use older versions of the mongodb image, it'll fix this problem for you:

image:
  tag: 3.2.11-r2
replicaSet:
  enabled: true
  name: rs0
  replicas:
    secondary: 1
    arbiter: 1
usePassword: false
# Need this because the older bitnami mongodb images won't work if you're not running as root
securityContext:
  enabled: false

This comes up. In fact, if you set usePassword: true here, this will fail with:

Error executing 'postInstallation': Not possible to configure replica set scenario using authentication. Please do not provided any of the following properties: username, password, database, rootPassword.

-_-

@lebenitza
Copy link
Contributor

I think this might need reopening considering the details in the linked issue :)

@arizawan
Copy link

I tried this command after many attempts. It seems like working for me.

helm -n oih-dev-ns install mongodb bitnami/mongodb --set usePassword=false --set replicaSet.enabled=false --set persistence.enabled=true --set mongodbRootPassword="" --set mongodbPassword=""

I am able to login without password

@humblewolf
Copy link

Just for info:: Fix for this issue was first shipped in mongo helm chart version 7.10.9 bitnami/charts@ff1db9d#diff-36d6c73e8bcce8b9eb984fba150cacb36170c85f85f688d273bff9791b47d08a

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

8 participants