-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Postgresql metrics container CreateContainerConfigError when replication mode. #30680
Copy link
Copy link
Closed
Labels
postgresqlsolvedtech-issuesThe user has a technical issue about an applicationThe user has a technical issue about an applicationtriageTriage is neededTriage is needed
Description
Name and Version
bitnami/postgresql 16.2.3
What architecture are you using?
None
What steps will reproduce the bug?
- enable
metricsand make itreplicationmode.
image:
registry: docker.io
repository: bitnami/postgresql
tag: 16.3.0-debian-12-r23
architecture: replication
auth:
postgresPassword: "test"
rootPassword: "test"
database: "testdb"
replicationPassword: "testrepl"
metrics:
enabled: true- install the chart on kubernetes
helm upgrade --install post-test bitnami/postgresql -f .\values.yaml
What is the expected behavior?
Metrics sidecar of read replica is successfully launched like that of primary pod.
What do you see instead?
I got a CreateContainerConfigError error.
The error description is Error: couldn't find key password in Secret default/post-test-postgresql.
It turns out it uses password not postgres-password.
statefulset.yaml in primary
# ...
env:
- name: DATA_SOURCE_URI
value: {{ printf "127.0.0.1:%d/postgres?sslmode=disable" (int (include "postgresql.v1.service.port" .)) }}
{{- if .Values.auth.usePasswordFiles }}
- name: DATA_SOURCE_PASS_FILE
value: {{ printf "/opt/bitnami/postgresql/secrets/%s" (include "postgresql.v1.adminPasswordKey" .) }}
{{- else }}
- name: DATA_SOURCE_PASS
valueFrom:
secretKeyRef:
name: {{ include "postgresql.v1.secretName" . }}
key: {{ include "postgresql.v1.adminPasswordKey" . }}
{{- end }}
- name: DATA_SOURCE_USER
value: "postgres"
{{- if .Values.metrics.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
# ...statefulset.yaml in read
# ...
env:
- name: DATA_SOURCE_URI
value: {{ printf "127.0.0.1:%d/postgres?sslmode=disable" (int (include "postgresql.v1.service.port" .)) }}
{{- if .Values.auth.usePasswordFiles }}
- name: DATA_SOURCE_PASS_FILE
value: {{ printf "/opt/bitnami/postgresql/secrets/%s" (include "postgresql.v1.userPasswordKey" .) }}
{{- else }}
- name: DATA_SOURCE_PASS
valueFrom:
secretKeyRef:
name: {{ include "postgresql.v1.secretName" . }}
key: {{ include "postgresql.v1.userPasswordKey" . }}
{{- end }}
- name: DATA_SOURCE_USER
value: {{ default "postgres" $customUser | quote }}
{{- if .Values.metrics.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
# ...I think DATA_SOURCE_PASS in the read replica should be postgresql.v1.adminPasswordKey not postgresql.v1.userPasswordKey. It needs to use postgresPassword when username is not set because the default value of DATA_SOURCE_USER is already set to postgres.
Additional information
In helm chart in mysql, primary and secondary use root for metrics.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
postgresqlsolvedtech-issuesThe user has a technical issue about an applicationThe user has a technical issue about an applicationtriageTriage is neededTriage is needed
