Skip to content

Overriding postgres.conf only works for the read replicas #190

@matheushent

Description

@matheushent

Hello.

I'm trying to customize some configurations in the postgres.conf following the documentation. Here it is the ConfigMap I created:

apiVersion: v1
kind: ConfigMap
metadata:
  name: postgres-config
data:
  postgres.conf: |
    # General
    shared_preload_libraries = 'timescaledb'

    # Replication configs
    listen_addresses = '*'
    max_wal_senders = 10
    max_connections = 100
    shared_buffers = 128MB

    # Logging
    log_destination = 'stderr,csvlog'
    logging_collector = on
    log_directory = 'pg_log'
    log_filename= 'postgresql-%Y-%m-%d_%H%M%S.log'

In the Kubegres manifest, I set the parameter customConfig: postgres-config as the docs states. The problem is that this custom config only gets properly mounted in the read replica, while the primary replica pod doesn't have the volume mounted. Here it is the volumeMounts I'm getting in the primary replica:

volumeMounts:
    - mountPath: /var/lib/postgresql/data
      name: postgres-db
    - mountPath: /docker-entrypoint-initdb.d/primary_create_replication_role.sh
      name: base-config
      subPath: primary_create_replication_role.sh
    - mountPath: /etc/postgres.conf
      name: base-config
      subPath: postgres.conf
    - mountPath: /docker-entrypoint-initdb.d/primary_init_script.sh
      name: base-config
      subPath: primary_init_script.sh
    - mountPath: /etc/pg_hba.conf
      name: base-config
      subPath: pg_hba.conf
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: kube-api-access-abcd1
      readOnly: true

Although I can see in the volumes that the custom config is there:

volumes:
  - configMap:
      defaultMode: 511
      name: base-kubegres-config
    name: base-config
  - configMap:
      defaultMode: 511
      name: postgres-config
    name: custom-config

I understand this is a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions