Create a PostgreSQL service

Apply the following object on your namespace, as specified by its YAML description.

Example to create a PostgreSQL instance
kind: ExoscalePostgreSQL
  name: my-postgres-example (1)
  namespace: my-namespace (2)
      timeOfDay: "12:00:00" (3)
      zone: ch-dk-2 (4)
      majorVersion: "14" (5)
        timezone: Europe/Zurich (6)
      plan: hobbyist-2 (7)
    name: postgres-creds (8)
1 Instance name
2 The namespace where the object will be created
3 Specify backup time of day
4 The Exoscale zone to use, see list of regions
5 PostgreSQL version
6 Specify custom PostgreSQL settings [optional]
7 See reference for a list of plans
8 Secret where the connection details are provisioned. This secret shouldn’t exist before creation.
To get more information about all available configuration options, please refer to the API Reference

Inspect your new PostgreSQL service

$ oc get exoscalepostgresql
NAMESPACE      NAME                  PLAN         ZONE      READY   CONNECTION-SECRET   AGE
my-namespace   my-postgres-example   hobbyist-2   ch-dk-2   True    postgres-creds      5m

When you see True in the READY column, it means the instance is provisioned and ready to use.

Find the connection details

The connection details are stored in a secret. You can retrieve them with the following command:

$ oc get secrets postgres-creds -o yaml

The output of the command above is a secret specification with the following structure:

apiVersion: v1
kind: Secret
  name: postgres-creds
  POSTGRESQL_DB: postgres (1)
  POSTGRESQL_PASSWORD: my-secret (3)
  POSTGRESQL_PORT: 21699 (4)
  POSTGRESQL_URL: postgres:// (5)
  POSTGRESQL_USER: postgres (6)
  ca.crt: base64encoded(data) (7)
  tls.crt: base64encoded(data) (8)
  tls.key: base64encoded(data) (9)
1 Database name
2 Host to connect to
3 Password
4 Port
5 URL containing all necessary information to connect to the instance
6 Username
7 ca.crt to use when using sslmode=verify-full
8 tls.crt to use when connecting to instance
9 tls.key to use when connecting to instance
Not all fields apply to all providers