Skip to content
_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN DE
Let's talk

StatefulSets in Production — PostgreSQL & Elasticsearch on K8s

06. 11. 2019 Updated: 27. 03. 2026 1 min read CORE SYSTEMSdata
This article was published in 2019. Some information may be outdated.
StatefulSets in Production — PostgreSQL & Elasticsearch on K8s

In 2017, we started with StatefulSets in beta. Today we run PostgreSQL clusters and Elasticsearch on Kubernetes in production. Two years of experience in one article.

PostgreSQL on Kubernetes

We use the Patroni operator for PostgreSQL HA. Three-node cluster: primary + 2 replicas. Automatic failover, streaming replication, point-in-time recovery from WAL archives in S3.

What works: automatic failover, backup scheduling, resource isolation. What’s challenging: storage performance tuning, major version upgrades (still a manual process), connection pooling (PgBouncer as a sidecar).

Elasticsearch on Kubernetes

Elastic Cloud on Kubernetes (ECK) operator. 3 master nodes, 3 data nodes, 2 coordinating nodes. Automatic scaling, rolling upgrades, snapshot backups.

The ECK operator is excellent — you define the desired state, the operator takes care of the rest. Upgrading Elasticsearch from 6.x to 7.x was done via rolling update with no downtime.

Lessons Learned

  • Storage class matters: SSD (gp2/gp3) for databases, always
  • Anti-affinity: replicas on different nodes/AZs
  • Resource requests = limits for guaranteed QoS
  • Test backups regularly — restore drill every month
  • Monitoring: databases need specific metrics (replication lag, connections, locks)

When NOT on Kubernetes

Extremely performance-sensitive workloads (bare metal latency is still lower). Huge databases (TB+) with complex sharding. Legacy databases without a Kubernetes operator.

Stateful Workloads on Kubernetes Are Production-Ready

With a good operator, proper storage, and disciplined operations, it works. But respect the limits — not every database belongs in Kubernetes.

statefulsetspostgresqlelasticsearchkubernetes
Share:

CORE SYSTEMS

We build core systems and AI agents that keep operations running. 15 years of experience with enterprise IT.

Need help with implementation?

Our experts can help with design, implementation, and operations. From architecture to production.

Contact us
Need help with implementation? Schedule a meeting