Skip to content

Commit 59baa6a

Browse files
author
Yannic Nevado Hidalgo
committed
right sourcerange for postgres load balancer, filebeat config and patroni.yml added
1 parent 0a0344a commit 59baa6a

File tree

5 files changed

+138
-2
lines changed

5 files changed

+138
-2
lines changed

elk-stack-config/filebeat.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
filebeat.config.modules:
2+
path: ${path.config}/modules.d/*.yml
3+
filebeat.modules:
4+
- module: postgresql
5+
filebeat.inputs:
6+
- type: docker
7+
containers.ids:
8+
- '*'
9+
processors:
10+
- add_kubernetes_metadata:
11+
in_cluster: true
12+
13+
output.elasticsearch:
14+
hosts: '${ELASTICSEARCH_HOSTS:elasticsearch-master:9200}'
15+
setup.kibana:
16+
host: 'efk-kibana:30126'

manifests/configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ data:
2525
enable_master_load_balancer: "true"
2626
# enable_pod_antiaffinity: "false"
2727
# enable_pod_disruption_budget: "true"
28-
enable_replica_load_balancer: "false"
28+
enable_replica_load_balancer: "true"
2929
# enable_shm_volume: "true"
3030
# enable_team_superuser: "false"
3131
enable_teams_api: "false"

manifests/minimal-postgres-manifest.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ spec:
3232
test: zalando
3333
# needed for shared_memory, in docker default=64mb
3434
enableShmVolume: true
35+
allowedSourceRanges: # load balancers' source ranges for both master and replica services
36+
- 192.168.0.0/16
3537
postgresql:
3638
version: "11"
3739
# parameters for postgresql.conf
@@ -62,4 +64,4 @@ spec:
6264
pg_hba:
6365
- hostssl all all 0.0.0.0/0 scram-sha-256
6466
- host all all 0.0.0.0/0 scram-sha-256
65-
- host all zalando 192.168.232.109/24 scram-sha-256
67+
- host all all 0.0.0.0/0 md5

patroni/patroni-master.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
bootstrap:
2+
dcs:
3+
loop_wait: 10
4+
maximum_lag_on_failover: 33554432
5+
postgresql:
6+
parameters:
7+
archive_mode: 'on'
8+
archive_timeout: 1800s
9+
autovacuum_analyze_scale_factor: 0.02
10+
autovacuum_max_workers: 5
11+
autovacuum_vacuum_scale_factor: 0.05
12+
checkpoint_completion_target: 0.9
13+
hot_standby: 'on'
14+
log_autovacuum_min_duration: 0
15+
log_checkpoints: 'on'
16+
log_connections: 'on'
17+
log_disconnections: 'on'
18+
log_line_prefix: '%t [%p]: [%l-1] %c %x %d %u %a %h '
19+
log_lock_waits: 'on'
20+
log_min_duration_statement: 500
21+
log_statement: ddl
22+
log_temp_files: 0
23+
max_connections: '10'
24+
max_replication_slots: 5
25+
max_wal_senders: 5
26+
tcp_keepalives_idle: 900
27+
tcp_keepalives_interval: 100
28+
track_functions: all
29+
wal_keep_segments: 8
30+
wal_level: hot_standby
31+
wal_log_hints: 'on'
32+
use_pg_rewind: true
33+
use_slots: true
34+
retry_timeout: 10
35+
ttl: 30
36+
initdb:
37+
- auth-host: scram-sha-256
38+
- auth-local: trust
39+
- data-checksums
40+
- encoding: UTF8
41+
- locale: en_US.UTF-8
42+
post_init: /scripts/post_init.sh "zalandos"
43+
users:
44+
zalandos:
45+
options:
46+
- CREATEDB
47+
- NOLOGIN
48+
password: ''
49+
kubernetes:
50+
labels:
51+
application: spilo
52+
pod_ip: 10.42.3.59
53+
ports:
54+
- name: postgresql
55+
port: 5432
56+
role_label: spilo-role
57+
scope_label: version
58+
use_endpoints: true
59+
namespace: zalando-postgres
60+
postgresql:
61+
authentication:
62+
replication:
63+
password: BSgbCfrHh5dFiAQ3qD7CPEmOC4hgR2aLoP6ooybd92SAqF6DtpuWo4yA0hrcRTPW
64+
username: standby
65+
superuser:
66+
password: 3A0S8YU2R36LzUhLIdeRZpjWAEdS6CK65sZ53vW1sehy4wqGfr6YeEISOIHSLADc
67+
username: postgres
68+
bin_dir: /usr/lib/postgresql/11/bin
69+
callbacks:
70+
on_role_change: /scripts/on_role_change.sh zalandos true
71+
connect_address: 10.42.3.59:5432
72+
data_dir: /home/postgres/pgdata/pgroot/data
73+
listen: 0.0.0.0:5432
74+
name: acid-minimal-cluster-2
75+
parameters:
76+
archive_command: /bin/true
77+
bg_mon.listen_address: 0.0.0.0
78+
extwlist.custom_path: /scripts
79+
extwlist.extensions: btree_gin,btree_gist,citext,hstore,intarray,ltree,pgcrypto,pgq,pg_trgm,postgres_fdw,uuid-ossp,hypopg,timescaledb,pg_partman
80+
listen_addresses: '*'
81+
log_destination: stderr
82+
log_directory: /var/log/postgresql
83+
log_file_mode: '0644'
84+
log_filename: postgresql-%u.log
85+
log_rotation_age: 1d
86+
log_statement: all
87+
log_truncate_on_rotation: 'on'
88+
logging_collector: 'on'
89+
pg_stat_statements.track_utility: 'off'
90+
shared_buffers: 128MB
91+
shared_preload_libraries: bg_mon,pg_stat_statements,pgextwlist,pg_auth_mon,timescaledb,pg_cron,pg_stat_kcache,set_user
92+
ssl: 'on'
93+
ssl_cert_file: /home/postgres/server.crt
94+
ssl_key_file: /home/postgres/server.key
95+
pg_hba:
96+
- hostssl all all 0.0.0.0/0 scram-sha-256
97+
- host all all 0.0.0.0/0 scram-sha-256
98+
- host all zalando 192.168.232.109/24 scram-sha-256
99+
- local all all trust
100+
- hostssl all +zalandos 127.0.0.1/32 pam
101+
- host all all 127.0.0.1/32 md5
102+
- hostssl all +zalandos ::1/128 pam
103+
- host all all ::1/128 md5
104+
- hostssl replication standby all md5
105+
- hostnossl all all all reject
106+
- hostssl all +zalandos all pam
107+
- hostssl all all all md5
108+
use_unix_socket: true
109+
restapi:
110+
connect_address: 10.42.3.59:8008
111+
listen: 0.0.0.0:8008
112+
scope: acid-minimal-cluster

patroni.md renamed to patroni/patroni.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2+
3+
4+
5+
6+
17
# Using Patroni Service
28

39
* Execute Shell on Pod

0 commit comments

Comments
 (0)