Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgresql metrics container CreateContainerConfigError when replication mode. #30680

Open
song2park opened this issue Nov 29, 2024 · 0 comments
Assignees
Labels
tech-issues The user has a technical issue about an application triage Triage is needed

Comments

@song2park
Copy link

song2park commented Nov 29, 2024

Name and Version

bitnami/postgresql 16.2.3

What architecture are you using?

None

What steps will reproduce the bug?

  1. enable metrics and make it replication mode.
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
  1. install the chart on kubernetes
helm upgrade --install post-test bitnami/postgresql -f .\values.yaml

Are you using any custom parameters or values?

No response

What is the expected behavior?

Metrics sidecar of read replica is successfully launched like that of primary pod.

What do you see instead?

image

I got 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 read replica should be postgresql.v1.adminPasswordKey not postgresql.v1.userPasswordKey. It need 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.

@song2park song2park added the tech-issues The user has a technical issue about an application label Nov 29, 2024
@github-actions github-actions bot added the triage Triage is needed label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-issues The user has a technical issue about an application triage Triage is needed
Projects
None yet
Development

No branches or pull requests

2 participants