I am trying to create a minimal postgres deployment with helm with a user called postgres.
I am hardcoding the password for now, the pod is being created correctly but i can’t access to the database!
I am trying to create a minimal postgres deployment with helm with a user called postgres.
Here’s my terraform code:
resource "helm_release" "postgres" {
name = "pg-${var.namespace}"
namespace = var.namespace
chart = "postgresql"
repository = "https://charts.bitnami.com/bitnami"
version = "13.4.4"
values = [templatefile("manifests/postgres-values.yaml", {
fullnameOverride = "pg-${var.namespace}"
pg_spot = var.pg_spot
pg_affinity = var.pg_affinity
pg_nodeSelector = var.pg_nodeSelector
pg_tolerations = var.pg_tolerations
db_pass = "postgres"
})]
set_sensitive {
name = "db_pass"
value = "postgres"
}
}
and here’s how my manifests/postgres-values.yaml looks like:
fullnameOverride: ${fullnameOverride}
global:
storageClass: managed-csi
postgresql:
auth:
username: postgres
password: ${db_pass}
service:
ports:
postgresql: 5432
primary:
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 100m
memory: 256Mi
persistence:
enabled: true
size: 1Gi
labels:
purpose: pg
persistentVolumeClaimRetentionPolicy:
enabled: true
whenDeleted: Retain
${indent(2, pg_nodeSelector)}
${indent(2, pg_tolerations)}
architecture: standalone
As you can see I am creating a user called postgres with a hardcoded password with the value **postgres **(no secrets for the moment).
I get my helm chart deployed correctly and my pod is running but when I execute:
psql -h localhost -p 5432 -U postgres
and provide postgres as password, i get this error:
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "postgres"
As if the user is not being created !!
enter image description here
Any ideas?