I'm trying to deploy postgres as a StatefulSet on k3d.
I set the environment variable POSTGRES_USER, but when I try to connect to the db, it isn't taken into account and I see that authentication has failed. I can login with the password pgpassword and default user postgres.
Why isn't the POSTGRES_USER taken into account?
This is my yml:
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgresql-db
spec:
serviceName: postgresql-db-service
selector:
matchLabels:
app: postgresql-db
replicas: 2
template:
metadata:
labels:
app: postgresql-db
spec:
containers:
- name: postgresql-db
image: postgres:latest
volumeMounts:
- name: postgresql-db-disk
mountPath: /data
env:
- name: POSTGRES_USER
value: pguser
- name: POSTGRES_PASSWORD
value: pgpassword
- name: PGDATA
value: /data/pgdata
volumes:
- name: postgresql-db-disk
hostPath:
# directory location on host
path: /opt/x/projects/tilt_test/data/
# this field is optional
type: DirectoryOrCreate