Kubegres is a Kubernetes operator allowing to deploy one or many clusters of PostgreSql instances and manage databases replication, failover and backup.
I've installed v1.17 and i set superuserpassword and replicapassword and config primary init script for create custom user but i can not login with postgres user and replication does not work and every time I've got below error
FATAL: password authentication failed for user "postgres"
I check the env on container and all envs are exist and several times I've tried to change pg_hba config file.
these are my files.
kind: ConfigMap
metadata:
name: postgres-conf
namespace: test-psql
data:
primary_init_script.sh: |
#!/bin/bash
set -e
dt=$(date '+%d/%m/%Y %H:%M:%S');
echo "$dt - Running init script the 1st time Primary PostgreSql container is created...";
echo "$dt - Running: psql -v ON_ERROR_STOP=1 --username $POSTGRES_USER --dbname $POSTGRES_DB ...";
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER '$POSTGRES_MY_USERNAME' WITH PASSWORD '$POSTGRES_MY_DB_PASSWORD';
CREATE DATABASE '$POSTGRES_MY_DB';
\connect $POSTGRES_MY_DB';
GRANT ALL ON SCHEMA public TO '$POSTGRES_MY_USERNAME';
EOSQL
echo "$dt - Init script is completed";
backup_database.sh: |
#!/bin/bash
set -e
dt=$(date '+%d/%m/%Y %H:%M:%S');
fileDt=$(date '+%d_%m_%Y_%H_%M_%S');
backUpFileName="$KUBEGRES_RESOURCE_NAME-backup-$fileDt.gz"
backUpFilePath="$BACKUP_DESTINATION_FOLDER/$backUpFileName"
echo "$dt - Starting DB backup of Kubegres resource $KUBEGRES_RESOURCE_NAME into file: $backUpFilePath";
echo "$dt - Running: pg_dumpall -h $BACKUP_SOURCE_DB_HOST_NAME -U postgres -c | gzip > $backUpFilePath"
pg_dumpall -h $BACKUP_SOURCE_DB_HOST_NAME -U postgres -c | gzip > $backUpFilePath
if [ $? -ne 0 ]; then
rm $backUpFilePath
echo "Unable to execute a BackUp. Please check DB connection settings"
exit 1
fi
echo "$dt - DB backup completed for Kubegres resource $KUBEGRES_RESOURCE_NAME into file: $backUpFilePath";
postgres.conf: |
# Replication configs
listen_addresses = '*'
max_wal_senders = 10
# wal_keep_segments = 48 #in Mb
max_connections = 5000
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'
pg_hba.conf: |
# TYPE DATABASE USER ADDRESS METHOD
# Replication connections by a user with the replication privilege
host replication replication all md5
# As long as it is authenticated, all connections allowed except from "0.0.0.0/0"
local all all md5
host all all all md5
host all all 0.0.0.0/0 reject
Hi
I've installed v1.17 and i set superuserpassword and replicapassword and config primary init script for create custom user but i can not login with postgres user and replication does not work and every time I've got below error
FATAL: password authentication failed for user "postgres"
I check the env on container and all envs are exist and several times I've tried to change pg_hba config file. these are my files.
#############
#########