This topic describes the properties you can define in a Postgres operator manifest file.

Synopsis

apiVersion: sql.tanzu.vmware.com/v1
kind: Postgres
metadata:
  name: <string>
spec:
  memory: <memory-limit>
  cpu: <cpu-limit>
  storageSize: <size>
  storageClassName: <storage-class>
  monitorStorageClassName: <storage-class>
  monitorStorageSize: <size>
  resources:
    monitor:
      limits:
        cpu: 1
        memory: 800Mi
      requests:
        cpu: 0.8
        memory: 400Mi
    metrics:
      limits:
        cpu: 0.8
        memory: 500Mi
      requests:
        cpu: 0.2
        memory: 100Mi
  pgConfig:
     dbname: <pg-instance-name>
     username: <pg-username>
  serviceType: <LoadBalancer|ClusterIP>
  highAvailability:
     enabled: <true|false>
  backupLocation:
     name: <backuplocation-name>
  certificateSecretName:: <certificate-secret>
  logLevel: Debug

Description

You specify Postgres instance configuration properties to the Postgres operator with a YAML-formatted manifest file. A sample manifest file is provided in postgres.yaml. The current version of the manifest supports configuring the Postgres instance name, default database name and user name, backup credentials, and memory, cpu, and storage settings for the instance. See also Deploying a New Postgres Instance for information about deploying a new Postgres instance using a manifest file.

Keywords and Values

Instance Metadata

name: <string>
(Required) Sets the name of the Postgres instance. The Postgres operator appends -0 to the end of the name when it creates the instance pod, for example postgres-sample-0. The new Postgres instance includes a default database with the same name as the instance unless you change the default database name with dbname.

You can filter the output of kubectl commands using this name. For example, if you set the name to postgres-sample then you can use commands like kubectl get all -l postgres-instance=postgres-sample or kubectl get pvc -l postgres-instance=postgres-sample to get all resources or pvc associated with the Postgres instance respectively.

Instance Configuration

memory: <memory-limit>
(Required) The amount of memory allocated to a Postgres instance pod. This value defines a memory limit; if a pod tries to exceed the limit it is removed and replaced by a new pod. You can specify a suffix to define the memory units (for example, 4.5Gi.). If left empty, the default for the Postgres instance is 800 mebibytes, or about 800 megabytes. See Assign Memory Resources to Containers and Pods in the Kubernetes documentation for more information.

cpu: <cpu-limit>
(Required) The amount of CPU resources allocated to a Postgres instance pod, specified as a Kubernetes CPU unit (for example, cpu: "1.2"). If left empty, the pod has no upper bound on the CPU resource it can use or inherits the default limit if one is specified in its deployed namespace. See Assign CPU Resources to Containers and Pods in the Kubernetes documentation for more information.

storageSize: <size>
(Required) The storage size of the Persistent Volume Claim (PVC) for a Postgres instance pod. Specify a suffix for the units (for example: 100G, 1T).

storageClassName: <storage-class>
(Required) The Storage Class name to use for dynamically provisioning Persistent Volumes (PVs) for a Postgres instance pod. If the PVs already exist, either from a previous deployment or because you manually provisioned the PVs, then the Operator uses the existing PVs. You can configure the Storage Class according to your performance needs. See Storage Classes in the Kubernetes documentation to understand the different configuration options.

monitorStorageClassName: <storage-class>
(Optional) The Storage Class name to use for dynamically provisioning Persistent Volumes (PVs) for the Postgres monitor pod. By default it is set to standard. The default value can be changed at the time of the Postgres instance initialization but the monitorStorageClassName must match the Postgres instance storageClassName.

monitorStorageSize: <size>
(Required) The storage size of the Persistent Volume Claim (PVC) for a Postgres instance monitor pod. Specify a suffix for the units (for example: 100G, 1T). The default value is 1G.

resources: <object>
(Optional)
Defaults: monitor.limits.cpu: 0.8, monitor.limits.memory: 800Mi
Defaults: metrics.limits.cpu: 0.1, metrics.limits.memory: 100Mi
This object is a mapping of strings to ResourceRequirements. The supported keys are monitor and metrics, which are containers in the data and monitor pod respectively.
A ResourceRequirements object describes the compute resource requirements (requests and limits of cpu and memory).

monitor:
  limits:
    cpu: 1
    memory: 800Mi
  requests:
    cpu: 0.8
    memory: 400Mi
metrics:
  limits:
    cpu: 0.8
    memory: 500Mi
  requests:
    cpu: 0.2
    memory: 100Mi

dbname: <pg-instance-name>
(Optional) The name of the default Postgres database. By default, the Postgres instance name (name: string) is used as the default database name. See Custom Database Name and User Account.

username: <pg-username>
(Optional) The name of the default Postgres user. By default, "pgadmin" is used as the default user name. See Custom Database Name and User Account.

serviceType: <LoadBalancer|ClusterIP>
(Optional) The Kubernetes publishing service used for the Postgres instance. ClusterIP is used by default, which exposes the Postgres service internally and uses cluster-internal IP address instead of a load balancer. See Publishing Services (ServiceTypes) in the Kubernetes documentation for more information.

highAvailability: enabled: <true|false>
(Optional) Specifies whether the Postgres instance is created in a single or cluster mode configuration. The default, false, creates single node cluster. See Configuring High Availability for more information about clustered Postgres deployments.

backupLocation: <backuplocation-name>
(Optional) When using a S3-compatible storage location for backups, this value specifies the PostgresBackupLocation CRD holding the configuration for the S3 backup location. For more details on configurating backup and restore, see Backing Up and Restoring.

certificateSecretName: <postgres-tls-secret>
(Optional) When using TLS security, this value specifies the secret created to enable TLS connections in the Postgres cluster. See Configuring TLS for Tanzu Postgres Instances.

loglevel: <debug>
(Optional) Set the level of information detail displayed in the logs. By default this field is not in the instance yaml, and the log level is non-verbose.

check-circle-line exclamation-circle-line close-line
Scroll to top icon