SGDistributedLogs

Creating a distributed logs cluster

The distributed logs CR represent a distributed logs cluster. When a cluster is configured to use a distributed logs cluster it will forward all logs from different sources to the distributed logs cluster. Under the hood, distributed log cluster use a SGCluster, therefore the distributed log cluster could be receive SQL queries in a postgres-util fashion but not with it.

For more information about distributed log usage please review the Distributed Log Cluster Administration Guide


Kind: SGDistributedLogs

listKind: SGDistributedLogsList

plural: sgdistributedlogs

singular: sgdistributedlogs


Spec

Property Required Updatable Type Default Description
persistentVolume string
Pod’s persistent volume configuration
postgresServices object
Kubernetes services created or managed by StackGres.
scheduling object
Pod custom scheduling configuration.
metadata object
Metadata information from cluster created resources.
nonProductionOptions array

Persistent volume

Property Required Updatable Type Default Description
size string
Size of the PersistentVolume set for the pod of the cluster for distributed logs. This size is specified either in Mebibytes, Gibibytes or Tebibytes (multiples of 2^20, 2^30 or 2^40, respectively).
storageClass string default storage class
Name of an existing StorageClass in the Kubernetes cluster, used to create the PersistentVolumes for the instances of the cluster.

Postgres Services

Property Required Updatable Type Default Description
primary object primary
Configuration for the -primary service. It provides a stable connection (regardless of primary failures or switchovers) to the read-write Postgres server of the cluster.
replicas object replicas
Configuration for the -replicas service. It provides a stable connection (regardless of replica node failures) to any read-only Postgres server of the cluster. Read-only servers are load-balanced via this service.

Primary service type

Property Required Updatable Type Default Description
type string ClusterIP
Specifies the type of Kubernetes service(ClusterIP, LoadBalancer, NodePort)
annotations object
Custom Kubernetes annotations passed to the -primary service.

Replicas service type

Property Required Updatable Type Default Description
enabled boolean true
Specify if the -replicas service should be created or not.
type string ClusterIP
Specifies the type of Kubernetes service(ClusterIP, LoadBalancer, NodePort).
annotations object
Custom Kubernetes annotations passed to the -replicas service.

Example:

apiVersion: stackgres.io/v1
kind: SGDistributedLogs
metadata:
  name: stackgres
spec:
  postgresServices:
    primary:
      type: ClusterIP
    replicas:
      enabled: true
      type: ClusterIP

Scheduling

Holds scheduling configuration for StackGres pods to have.

Property Required Updatable Type Default Description
nodeSelector object
Pod custom node selector.
tolerations array
Pod custom node tolerations

Tolerations

Holds scheduling configuration for StackGres pods to have.

Property Required Updatable Type Default Description
key string
Pod custom node selector.
operator string Equal
Pod custom node tolerations
value string
Pod custom node tolerations
effect string match all taint effects
Pod custom node tolerations

Metadata

Holds custom metadata information for StackGres generated resources to have.

Property Required Updatable Type Default Description
annotations object
Custom Kubernetes annotations to be passed to resources created and managed by StackGres.

Annotations

Holds custom annotations for StackGres generated resources to have.

Property Required Updatable Type Default Description
allResources object
Annotations to attach to any resource created or managed by StackGres.
pods object
Annotations to attach to pods created or managed by StackGres.
services object
Annotations to attach to services created or managed by StackGres.
apiVersion: stackgres.io/v1
kind: SGDistributedLogs
metadata:
  name: stackgres
spec:
  pods:
    metadata:
      annotations:
        allResources:
          customAnnotations: customAnnotationValue

Non Production options

The following options should NOT be enabled in a production environment.

Property Required Updatable Type Default Description
disableClusterPodAntiAffinity boolean false

It is a best practice, on non-containerized environments, when running production workloads, to run each database server on a different server (virtual or physical), i.e., not to co-locate more than one database server per host.

The same best practice applies to databases on containers. By default, StackGres will not allow to run more than one StackGres or Distributed Logs pod on a given Kubernetes node. If set to true it will allow more than one StackGres pod per node.

Example:

apiVersion: stackgres.io/v1
kind: SGDistributedLogs
metadata:
  name: distributedlogs
spec:
  persistentVolume:
    size: 10Gi