Create a PostgreSQL database
The Cloudnative PostgreSQL database operator is installed by default. Teams can use the operator and the PostgreSQL quick start template to create their own PostgreSQL databases.
Create a database
You can create a postgresql database from the Catalog:
- 
Go to Catalog in the left menu and click on the postgresql template.
 - 
Click on Values.
 - 
Fill in a name for the database.
 - 
Change other parameter values if required.
 - 
Click Submit.
 
The operator will now create the database and add the secret <database-name>-app to the team's namespace. This secret contains the username and password for the database with the keys username and password.
You can now provide the username and password to a container as environment variables using a secretKeyRef:
env:
  - name: DB_USER
    valueFrom:
      secretKeyRef:
        name: <database-name>-app
        key: username
  - name: DB_PASSWORD
    valueFrom:
      secretKeyRef:
        name: <database-name>-app
        key: password
Monitoring
The postgresql quick start template includes two parameters that can be used to create a PodMonitor and a Grafana Dashboard. Set the monitoring parameter to true to create a PodMonitor and set the dashboard parameter to true to add a cloudnativepg dashboard to the Team's Grafana. Note that this dashboard can be used to monitor multiple databases so you'll just need to create it once.
Updated 5 months ago
