Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Kubernetes Operators for PostgreSQL

Kubernetes Operators for PostgreSQL

The growing shift of workloads into Kubernetes environments has led to a paradigm shift for databases as well, including PostgreSQL. While simple deployments may still be handwritten or use Helm as a "package manager" for more complex applications, the situation is different when it comes to databases. Here, operators are preferred for their features and convenience. Operators are tools that simplify automation, management, and high availability for PostgreSQL databases on Kubernetes.
However, there are several providers of such operators, raising the question: which one is best suited for your use case?
This presentation compares the following five operators based on conceptual and measurable criteria:

- Crunchy Postgres for Kubernetes
- CloudNativePG
- Zalando Postgres Operator
- StackGres
- KubeDB by AppsCode

The results of the comparison show that while all operators are similar in terms of features, KubeDB and CloudNativePG stand out with significantly faster failover times.

Avatar for Alex Senger

Alex Senger

November 27, 2025

Other Decks in Programming

Transcript

  1. • IT-Consultant • DevOps • Python Developer / Trainer •

    Tech-Stack About Me Alex Senger, Database Tamers in the Cluster
  2. Alex Senger, Database Tamers in the Cluster „Datenbanken sollten besser

    außerhalb von Kubernetes betrieben werden.“ „Kubernetes – Wer nicht skaliert, verliert“ (2018), itemis Blog
  3. Kubernetes Control Loop (2) Alex Senger, Database Tamers in the

    Cluster Stateful Δ Stateless api-654975c8cd-lsw22 db-1 (primary) db-2 (replica)
  4. What features are missing for PostgreSQL? • Leader Election •

    Backups / Restores • Upgrades / Rollouts • Dynamic Management of the pg_hba.conf • Monitoring • … Alex Senger, Database Tamers in the Cluster
  5. Timeline Alex Senger, Database Tamers in the Cluster 2016 Introduction

    of Kubernetes Operators 2018 Release of the itemis blog post 2019 Release of Zalando's Postgres-Operator on OperatorHub
  6. Kubernetes Operators • Custom Resource Definitions (CRDs) • Undefined behavior

    • Controller • Implements a Control Loop • Defines behavior on Resources Alex Senger, Database Tamers in the Cluster
  7. Alex Senger, Database Tamers in the Cluster „Datenbanken sollten besser

    außerhalb von Kubernetes betrieben werden.“ „Kubernetes – Wer nicht skaliert, verliert“ (2018), itemis Blog
  8. Operators • Crunchy Postgres for Kubernetes • CloudNativePG • Zalando

    Postgres Operator • KubeDB by AppsCode • StackGres Alex Senger, Database Tamers in the Cluster
  9. Core requirements • Creation of PostgreSQL Clusters • Synchronous replication

    • Streaming replication • Backups and restores • Monitoring capabilities • Automatic failover mechanisms Alex Senger, Database Tamers in the Cluster Replica Replica Primary
  10. Crunchy Postgres Operator • Operator uses Patroni • Tools: •

    pgBackRest • pgMonitor • Extensive and detailed documentation Alex Senger, Database Tamers in the Cluster
  11. CloudNativePG (CNPG) • Own implementation for replication and failover mechanisms

    • Supported by the Cloud Native Computing Foundation (CNCF) Alex Senger, Database Tamers in the Cluster
  12. Zalando Postgres Operator • Operator uses Spilo (PostgreSQL + patroni

    in Docker) • Backups and Point-In-Time-Recovery with pg_base_backup and WAL-E • User interface for cluster creation Alex Senger, Database Tamers in the Cluster
  13. Zalando Postgres Operator • Operator uses Spilo (PostgreSQL + patroni

    in Docker) • Backups and Point-In-Time-Recovery with pg_base_backup and WAL-E • User Interface for Cluster creation • No ootb metric exports for operator and databases • No autoscaling capabilities Alex Senger, Database Tamers in the Cluster
  14. KubeDB • Own implementation for replication and failover mechanisms •

    Databases: • PostgreSQL • MySQL • MariaDB • MongoDB • … • Proprietary with paid licences Alex Senger, Database Tamers in the Cluster
  15. StackGres • Made by OnGres • Replication and failover via

    Patroni • User Interface Alex Senger, Database Tamers in the Cluster
  16. Core requirement coverage Alex Senger, Database Tamers in the Cluster

    PostgreSQL Clusters Synchronous Replication Streaming Replication Backups and Restores (ootb) Monitoring Automatic failover
  17. Failover load test (2) Alex Senger, Database Tamers in the

    Cluster Inserting timestamps (UUIDv7) replica 1 replica 2 primary
  18. Failover load test: Crunchy PGO Alex Senger, Database Tamers in

    the Cluster Crunchy PGO Failures 5 Mean Failover Time 31s Min 29s Max 32s
  19. Failover load test: CloudNativePG Alex Senger, Database Tamers in the

    Cluster CloudNativePG Failures 8 Mean Failover Time 10s Min 7s Max 28s
  20. Failover load test: Zalando Alex Senger, Database Tamers in the

    Cluster Zalando Failures 10 Mean Failover Time 22s Min 22s Max 23s
  21. Failover load test: KubeDB Alex Senger, Database Tamers in the

    Cluster KubeDB Failures 6 Mean Failover Time 5s Min 4s Max 6s
  22. Failover load test: StackGres Alex Senger, Database Tamers in the

    Cluster StackGres Failures 6 Mean Failover Time 68s Min 68s Max 68s
  23. Conclusion • All five operators are very comparable when it

    comes to features • (Like always) the decision for an operator is dependent on your specific use case • Failover time winners: KubeDB and CloudNativePG • GET TO KNOW YOUR SYSTEMS Alex Senger, Database Tamers in the Cluster
  24. https://www.ordix.de/ Aktiengesellschaft für Softwareentwicklung, Schulung, Beratung und Systemintegration Zentrale Paderborn

    Karl-Schurz-Straße 19a 33100 Paderborn Tel.: 05251 1063-0 Fax: 0180 1 67349 0 Seminarzentrum Wiesbaden Kreuzberger Ring 13 65205 Wiesbaden Tel.: 0611 77840-00 [email protected] https://www.ordix.de/ Thank you for your attention