All properties explained

The "Kubegres" API types are available in GitHub.

Kubegres uses predefined templates to create Kubernetes resources. Those templates are available in GitHub.

Please see below a Kubegres resource YAML containing all available properties, followed by a table explaining the meaning of each property:

apiVersion: kubegres.reactive-tech.io/v1
kind: Kubegres
metadata:
  name: mypostgres
  namespace: default
  annotations:
    imageregistry: "https://hub.docker.com/"
    nginx.ingress.kubernetes.io/affinity: cookie

spec:

   replicas: 3
   image: postgres:13.2
   port: 5432

   imagePullSecrets:
      - name: my-private-docker-repo-secret

   database:
      size: 200Mi
      storageClassName: standard
      volumeMount: /var/lib/postgresql/data

   customConfig: mypostgres-conf

   backup:
      schedule: "* */1 * * *"
      pvcName: my-backup-pvc
      volumeMount: /var/lib/backup

   env:
      - name: POSTGRES_PASSWORD
        valueFrom:
           secretKeyRef:
              name: mySecretResource
              key: superUserPassword

      - name: POSTGRES_REPLICATION_PASSWORD
        valueFrom:
           secretKeyRef:
              name: mySecretResource
              key: replicationUserPassword

                        

Property If not set in YAML, default value Meaning
name   Required.
The unique name of a Kubegres resource in Kubernetes. It defines the unique name of a PostgreSql cluster, which is "mypostgres" for this example.
Kubegres operator allows creating as many clusters as a given infrastructure can handle as long as each cluster's name is unique.
namespace default Optional.
The namespace where the Kubegres resource will be created and a PostgreSql cluster will be deployed.
annotations   Optional.
The annotations to pass to the created Pods and StatefulSets. You can set as many annotations as you need.
As an example, in the YAML above we set the annotations:
- imageregistry: "https://hub.docker.com/
- nginx.ingress.kubernetes.io/affinity: cookie.
spec
 replicas
  Required.
It defines a cluster of 3 Postgres pods, one primary server and 2 replica servers. If we set this value to 1, it will only create a primary server without any replica servers.
spec
 image
  Required.
It is the official PostgreSql docker image. Kubegres works with the official PostgreSql docker image. Consequently, it does not ship with a custom Docker image with obscure set of libraries. More details about the Postgres docker image in Docker Hub.
spec
 imagePullSecrets
  Optional.
It allows to pull custom Postgres images from a private repo. The images have to be compatible with PostgreSql containers.
More details about the type of this field (search for "imagePullSecrets" in the table).
spec
 port
5432 Optional.
The port exposed by PostgreSql docker container allowing to access to PostgreSql server.
spec
 database
  size
  Required.
The max size of all database(s) managed by a PostgreSql server. We use "Mi" for Megabyte and "Gi" for Gigabyte.
spec
 database
  storageClassName
Uses the default storageClass defined in a Kubernetes cluster Optional.
It defines the storage class which will be used to store PostgreSql database. A volume backed by a StorageClass is mounted into the path defined by "spec.database.volumeMount" (see below). Behind the scenes, Kubernetes creates a Persistence-Volume-Claim (PVC) for each pod and associates it to the given Storage-Class name.
spec
 database
  volumeMount
/var/lib/postgresql/data Optional.
It defines the storage class which will be used to store PostgreSql database. A volume backed by a Storage-Class is mounted into the path defined by "spec.database.volumeMount" (see below). Behind the scenes, PostgreSql creates a Persistence-Volume-Claim (PVC) for each pod and associates it to the given Storage-Class name.
spec
 customConfig
base-kubepostgres-config Optional.
It allows setting the name of a ConfigMap which contains the configs files and their contents required by Kubegres.
More details here.
spec
 backup
  schedule
  Optional, unless if we want to enable backup.
It schedules a back-up every hour. Its format follows the standard Cron spec.
More details here.
spec
 backup
  pvcName
  Optional, unless if we want to enable backup.
The Persistence-Volume-Claim (PVC) defining where the back-up data will be stored. A volume backed by a PVC is mounted into the path defined by "spec.backup.volumeMount" (see below).
More details here.
spec
 backup
  volumeMount
  Optional, unless if we want to enable backup.
The location where the backup is stored in the docker image. A volume is mounted on that path using the PVC name defined by "spec.database.pvcName".
More details here.
spec
 env
  name
  Required.
The password of the super user "postgres". This user is created by the official PostgreSql docker image.
spec
 env
  name
  Required.
The password of the "replication" user which is used by PostgreSql to replicate data between Primary and Replicas servers.