3. ARMIN NESIREN
Database engineer
● work on Postgresql HA since 8.3
● working for CYBERTEC since 2017
M A I L armin.nesiren@cybertec.at
4. DATABASE SERVICES
DATA Science
▪ Artificial Intelligence
▪ Machine Learning
▪ Big Data
▪ Business Intelligence
▪ Data Mining
▪ etc.
POSTGRESQL Services
▪ 24/7 Support
▪ Training
▪ Consulting
▪ Performance Tuning
▪ Clustering
▪ etc.
5.
6. ▪ ICT
▪ University
▪ Government
▪ Automotive
▪ Industry
▪ Trade
▪ Finance
▪ etc.
CLIENT
SECTORS
8. WHAT I WILL
TALK ABOUT
● A little about containers and their role
● Containers managed by K8s
● (A little about) Kubernetes storages
● Deploying PostgreSQL inside kubernetes simple way *
● About K8s operators
● Deploying PostgreSQL automated with operator
● Handling failover & recovery
● Handling backups
9. CONTAINERS IN
GENERAL
● We love them because
○ they ‘cost’ us less
○ lightweight
○ standalone
○ they run the same on any env
10. CONTAINERS
IN KUBERNETES
● Kubernetes is dealing with containers
● Kubernetes helps you avoid downtime
● Service discovery and load balancing
● Storage orchestration
● Automated rollouts and rollbacks
● Self-healing
● Secret and configuration management
11. BARE METAL
VS PROVIDERS
● Providers
○ less stress but some limitations
● Bare metal
○ as low as 3-5 servers
○ storage options
○ exposing of services
15. SIMPLE DEPLOYMENT OF
POSTGRESQL IN K8S
● define postgresql container and pass parameters
● it would be a long YAML to manage
● Pretty hard to configure
● Not easy to manipulate with clusters (update, delete…)
● Manual generation of DB objects after setup
16. WHAT IF THERE IS...
● … small docker image with just what we need
● Multiple versions of PostgreSQL inside one image
● Plenty of extensions (pg_partman, pg_cron, postgis…)
● Additional tools (pgq, pgbouncer, wal-e/wal-g)
● Environment-variables based configuration
● Light! ~120MB
17. AND WE WANT IT ALL...
● …. so we add Patroni
● Automatic failover solution for streaming replication
● A python daemon that manages one PostgreSQL instance
● Keeps the cluster state in DCS (etcd, zookeeper, consul)
○ Uses DCS for leader election
● Helps automate things like
○ new cluster deployment
○ scaling out and in
○ PostgreSQL configuration management
20. KUBERNETES OPERATOR
● Encapsulates knowledge of a human operating the service
● Fully automated:
○ deployments
○ cluster upgrades
○ user management
25. SCALE AND CONFIG
● Adding more nodes is easy
● as well as removing them
● Changing configuration is also easy
● It is all matter of changing Postgresql CDR
manifest
26. BACKUP
● Backup can be done multiple way
● Logical (pg_dump) or streaming (WAL-E or WAL-G)
● PITR available
● Restore is easy