How to create multiple databases on same cluster of postgres operator?

5/4/2021

I installed Crunchydata Postgres Operator on K8S by following this link

I found the following link to create PG Cluster.

resource "kubectl_manifest" "pgocluster" {
  yaml_body = <<YAML
apiVersion: crunchydata.com/v1
...........
...........
...........
kind: Pgcluster
  ccpimage: crunchy-postgres-ha
  ccpimageprefix: registry.developers.crunchydata.com/crunchydata
  ccpimagetag: centos8-13.2-4.6.2
  clustername: ${pgo_cluster_name}
  **database: ${pgo_cluster_name}**
...........
...........
...........
YAML
}

With the definition mentioned above I would be able to create only-one database.

Is there any way to create multiple databases on the same cluster using 'custom-resource-definition' on Kubernetes ?

EDIT:

If multiple databases cannot be created on the same cluster, kindly let me know how to create multiple clusters using CRD

-- Sathish Kumar
kubernetes
postgresql

1 Answer

4/10/2022

Its possible to create multiple databases in the same cluster. I have used the below reference for pgo client to do that . First you need to create a superuser and then use that super user to create multiple databases in the cluster. I havent used CRDs to create the databases if you are looking for that specific way to create databases.

https://access.crunchydata.com/documentation/postgres-operator/4.6.2/pgo-client/reference/pgo_create_cluster/

-- Manmohan Mittal
Source: StackOverflow