'how to use postgres.db.name for multiple databases in kubernetes configMaps

So I want to create multiple postgresql databases in the kubernetes deployment. I tried with the below configMaps configuration but the databases are not being created. I tried to log into the postgres db pod with one of the database names I used in the configMaps but it say's the databse doesn't exist.

method 1:

apiVersion: v1
kind: ConfigMap
metadata:
  name: hydra-kratos-postgres-config
  labels:
    app: hydra-kratos-db
data:
  postgres.db.user: pguser
  postgres.db.password: secret
  postgres.db.name: 
    - postgredb1
    - postgredb2
    - postgredb3

method 2:

apiVersion: v1
kind: ConfigMap
metadata:
  name: hydra-kratos-postgres-config
  labels:
    app: hydra-kratos-db
data:
  POSTGRES_USER: pguser
  POSTGRES_PASSWORD: secret
  POSTGRES_MULTIPLE_DATABASES:
    - kratos
    - hydra


Would appreciate any suggestions on this. Thank you.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source