Document the ways to pass mongoDB authentications
When writing the helm to deploy the applications, we had the issue that the mongo connection was not authenticated.
Actually, a kubernetes secret contains the mongo_url
with the login and password:
apiVersion: v1
kind: Secret
metadata:
name: mongodb-settings
labels:
app: app
chart: '{{ .Chart.Name }}-{{ .Chart.Version }}'
release: '{{ .Release.Name }}'
heritage: '{{ .Release.Service }}'
type: Opaque
stringData:
mongo_url: "mongodb://{{ .Values.mongoUsername }}:{{ .Values.mongoPassword }}@{{ .Values.mongoName }}:{{ .Values.mongoPort }}/{{ .Values.mongoDatabase }}"
and used in the deployment:
env:
- name: MONGO_URL
valueFrom:
secretKeyRef:
name: mongodb-settings
key: mongo_url
Is it mandatory to pass the authentication directly in the URL?