72 lines
2.4 KiB
Markdown
72 lines
2.4 KiB
Markdown
---
|
|
title: "From Zero to Hero: Scaling Postgres in Kubernetes Using the Power of CloudNativePG"
|
|
weight: 8
|
|
tags:
|
|
- platform
|
|
- operators
|
|
- db
|
|
---
|
|
|
|
A short Talk as Part of the DOK day - presendet by the VP of CloudNative at EDB (one of the biggest PG contributors)
|
|
Stated target: Make the world your single point of failure
|
|
|
|
## Proposal
|
|
|
|
* Get rid of Vendor-Lockin using the oss projects PG, K8S and CnPG
|
|
* PG was the DB of the year 2023 and a bunch of other times in the past
|
|
* CnPG is a Level 5 mature operator
|
|
|
|
## 4 Pillars
|
|
|
|
* Seamless KubeAPI Integration (Operator PAttern)
|
|
* Advanced observability (Prometheus Exporter, JSON logging)
|
|
* Declarative Config (Deploy, Scale, Maintain)
|
|
* Secure by default (Robust contaienrs, mTLS, and so on)
|
|
|
|
## Clusters
|
|
|
|
* Basic Ressource that defines name, instances, snyc and storage (and other params that have same defaults)
|
|
* Implementation: Operator creates:
|
|
* The volumes (PG_Data, WAL (Write ahead log)
|
|
* Primary and Read-Write Service
|
|
* Replicas
|
|
* Read-Only Service (points at replicas)
|
|
* Failover:
|
|
* Failure detected
|
|
* Stop R/W Service
|
|
* Promote Replica
|
|
* Activat R/W Service
|
|
* Kill old promary and demote to replica
|
|
|
|
## Backup/Recovery
|
|
|
|
* Continuos Backup: Write Ahead Log Backup to object store
|
|
* Physical: Create from primary or standby to object store or kube volumes
|
|
* Recovery: Copy full backup and apply WAL until target (last transactio or specific timestamp) is reached
|
|
* Replica Cluster: Basicly recreates a new cluster to a full recovery but keeps the cluster in Read-Only Replica Mode
|
|
* Planned: Backup Plugin Interface
|
|
|
|
## Multi-Cluster
|
|
|
|
* Just create a replica cluster via WAL-files from S3 on another kube cluster (lags 5 mins behind)
|
|
* You can also activate replication streaming
|
|
|
|
## Reccomended architecutre
|
|
|
|
* Dev Cluster: 1 Instance without PDB and with Continuos backup
|
|
* Prod: 3 Nodes with automatic failover and continuos backups
|
|
* Symmetric: Two clusters
|
|
* Primary: 3-Node Cluster
|
|
* Secondary: WAL-Based 3-Node Cluster with a designated primary (to take over if primary cluster fails)
|
|
* Symmetric Streaming: Same as Secondary, but you manually enable the streaming api for live replication
|
|
* Cascading Replication: Scale Symmetric to more clusters
|
|
* Single availability zone: Well, do your best to spread to nodes and aspire to streched kubernetes to more AZs
|
|
|
|
## Roadmap
|
|
|
|
* Replica Cluster (Symmetric) Switchover
|
|
* Synchronous Symmetric
|
|
* 3rd PArty Plugins
|
|
* Manage DBs via the Operator
|
|
* Storage Autoscaling
|