arianitu / postgres-statefulset Goto Github PK
View Code? Open in Web Editor NEWThis example uses Kubernetes StatefulSets to setup Postgres + replication on Kubernetes
This example uses Kubernetes StatefulSets to setup Postgres + replication on Kubernetes
I keep getting FATAL: role "password=" does not exist
from the kubectl container logs. I've been working on this for a day now and can't find what's wrong yet. The secrets have been applied and it seems to have the POSTGRES_PASSWORD
env var just fine. There's no password=
in the code and no errors like this on Stack Overflow, those are mostly talking about Postgres User Roles missing.
Any help to get me unstuck would be greatly appreciated.
Thank you @arianitu
🙇🏻♂️
> $ k logs postgres-0 --all-containers=true ⬡ 8.11.4 [±hauser ●●]
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data/pgdata ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
syncing data to disk ... ok
Success. You can now start the database server using:
pg_ctl -D /var/lib/postgresql/data/pgdata -l logfile start
waiting for server to start....2019-08-25 07:22:31.295 UTC [41] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2019-08-25 07:22:31.307 UTC [42] LOG: database system was shut down at 2019-08-25 07:22:31 UTC
2019-08-25 07:22:31.310 UTC [41] LOG: database system is ready to accept connections
done
server started
/usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/create-dev-db.sh
CREATE DATABASE
GRANT
/usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/create-replica-user.sh
CREATE ROLE
2019-08-25 07:22:31.751 UTC [41] LOG: received fast shutdown request
waiting for server to shut down....2019-08-25 07:22:31.752 UTC [41] LOG: aborting any active transactions
2019-08-25 07:22:31.753 UTC [41] LOG: worker process: logical replication launcher (PID 48) exited with exit code 1
2019-08-25 07:22:31.755 UTC [43] LOG: shutting down
2019-08-25 07:22:31.774 UTC [41] LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
2019-08-25 07:22:31.862 GMT [1] LOG: skipping missing configuration file "/etc/replica.conf"
2019-08-25 07:22:31.862 GMT [1] LOG: skipping missing configuration file "/etc/replica.conf"
2019-08-25 07:22:31.865 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2019-08-25 07:22:31.865 UTC [1] LOG: listening on IPv6 address "::", port 5432
2019-08-25 07:22:31.869 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2019-08-25 07:22:31.888 UTC [68] LOG: database system was shut down at 2019-08-25 07:22:31 UTC
2019-08-25 07:22:31.893 UTC [1] LOG: database system is ready to accept connections
2019-08-25 07:23:20.352 UTC [75] FATAL: role "password=" does not exist
2019-08-25 07:23:23.595 UTC [82] FATAL: role "password=" does not exist
Running on K8s 1.15.2 the master node throws an error about the PostgreSQL.conf
file and could be related to it thinking that it is reading a directory and not a file.
Hello,
I came across this project and the blog post, and tried getting the instances to start using the instructions in the readme. However, when I perform kubectl get all
, it always shows the pods in Pending status. Not sure if this is because the readme is missing something or is out of date.
Replication works - however for the replica, having 'standby = on' does not actually have it be promoted as the master in the case of failure of the master db pod. Has failover ever been tested with this setup?
Hi,
Streaming replication is not setup and the logs are showing missing files? Any hint? below are the logs for the master and the slave....
2020-04-06 11:09:38.597 GMT [1] LOG: skipping missing configuration file "/etc/replica.conf"
2020-04-06 11:09:38.597 GMT [1] LOG: skipping missing configuration file "/etc/replica.conf"
2020-04-06 11:09:38.606 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-04-06 11:09:38.606 UTC [1] LOG: listening on IPv6 address "::", port 5432
2020-04-06 11:09:38.624 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-04-06 11:09:38.693 UTC [22] LOG: database system was interrupted; last known up at 2020-04-06 11:09:36 UTC
2020-04-06 11:09:39.737 UTC [22] LOG: database system was not properly shut down; automatic recovery in progress
2020-04-06 11:09:39.742 UTC [22] LOG: invalid record length at 0/1633A18: wanted 24, got 0
2020-04-06 11:09:39.742 UTC [22] LOG: redo is not required
2020-04-06 11:09:39.793 UTC [1] LOG: database system is ready to accept connections
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data/pgdata ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
syncing data to disk ... ok
Success. You can now start the database server using:
pg_ctl -D /var/lib/postgresql/data/pgdata -l logfile start
waiting for server to start....2020-04-06 11:10:33.135 UTC [52] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-04-06 11:10:33.195 UTC [53] LOG: database system was shut down at 2020-04-06 11:10:31 UTC
2020-04-06 11:10:33.212 UTC [52] LOG: database system is ready to accept connections
done
server started
/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
2020-04-06 11:10:33.317 UTC [52] LOG: received fast shutdown request
waiting for server to shut down....2020-04-06 11:10:33.319 UTC [52] LOG: aborting any active transactions
2020-04-06 11:10:33.323 UTC [52] LOG: worker process: logical replication launcher (PID 59) exited with exit code 1
2020-04-06 11:10:33.323 UTC [54] LOG: shutting down
2020-04-06 11:10:33.402 UTC [52] LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
2020-04-06 11:10:33.431 GMT [1] LOG: skipping missing configuration file "/etc/master.conf"
2020-04-06 11:10:33.432 GMT [1] LOG: skipping missing configuration file "/etc/master.conf"
2020-04-06 11:10:33.437 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-04-06 11:10:33.437 UTC [1] LOG: listening on IPv6 address "::", port 5432
2020-04-06 11:10:33.460 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-04-06 11:10:33.508 UTC [61] LOG: database system was shut down at 2020-04-06 11:10:33 UTC
2020-04-06 11:10:33.524 UTC [1] LOG: database system is ready to accept connections....
Thanks...
My k8s version:
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:31:21Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:25:06Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"linux/amd64"}
k8s pod:
NAMESPACE NAME READY STATUS RESTARTS AGE
default postgres-0 0/1 Pending 0 4m21s
kube-system coredns-558bd4d5db-7b7p7 1/1 Running 1 82m
kube-system coredns-558bd4d5db-tn928 1/1 Running 1 82m
kube-system etcd-k8s-master 1/1 Running 1 82m
kube-system kube-apiserver-k8s-master 1/1 Running 1 82m
kube-system kube-controller-manager-k8s-master 1/1 Running 1 82m
kube-system kube-flannel-ds-9n4xx 1/1 Running 0 18m
kube-system kube-flannel-ds-pbqfg 1/1 Running 1 72m
kube-system kube-flannel-ds-tjt97 1/1 Running 1 72m
kube-system kube-proxy-ncrx4 1/1 Running 0 18m
kube-system kube-proxy-vb7fn 1/1 Running 1 82m
kube-system kube-proxy-vqshc 1/1 Running 1 76m
kube-system kube-scheduler-k8s-master 1/1 Running 1 82m
kube-system metrics-server-6f6cfbf68-lfhx6 1/1 Running 1 27m
error while running "VolumeBinding" filter plugin for pod "postgres-replica-0": pod has unbound immediate PersistentVolumeClaims
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.