<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/highly-available-postgresql-on-kubernetes-in-10-minutes-72lxmcugy" -->

---
title: Highly Available PostgreSQL on Kubernetes in 10 Minutes
description: A step-by-step walkthrough shows how to deploy a highly available PostgreSQL cluster on Kubernetes using the CYBERTEC PG Operator (CPO), running PostgreSQL...
canonical: https://daily.dev/posts/highly-available-postgresql-on-kubernetes-in-10-minutes-72lxmcugy
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Highly Available PostgreSQL on Kubernetes in 10 Minutes | daily.dev
og:description: A step-by-step walkthrough shows how to deploy a highly available PostgreSQL cluster on Kubernetes using the CYBERTEC PG Operator (CPO), running PostgreSQL...
og:url: https://daily.dev/posts/highly-available-postgresql-on-kubernetes-in-10-minutes-72lxmcugy
og:image: https://api.daily.dev/og/posts/72lXMcUgY.png
og:image:alt: Highly Available PostgreSQL on Kubernetes in 10 Minutes
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Highly Available PostgreSQL on Kubernetes in 10 Minutes

**[CYBERTEC PostgreSQL](https://daily.dev/sources/cybertec_postgresql)** · 3 min read · 8 upvotes · 0 comments

## Summary

A step-by-step walkthrough shows how to deploy a highly available PostgreSQL cluster on Kubernetes using the CYBERTEC PG Operator (CPO), running PostgreSQL 18.4 on a minikube (Kubernetes 1.30) cluster. With a 14-line YAML manifest and numberOfInstances: 2, the operator sets up a leader and a streaming replica with automatic failover managed by Patroni. The guide demonstrates verifying replication status via patronictl, testing write/read behavior across leader and replica, and confirming the replica correctly rejects write attempts. It also flags a minikube-specific gotcha: disabling pod anti-affinity for single-node testing, which should remain enabled in production multi-node clusters.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.cybertec-postgresql.com/en/highly-available-postgresql-on-kubernetes-in-10-minutes>

## Questions this post answers

### How do I set up a highly available PostgreSQL cluster on Kubernetes using minikube?

Install the CYBERTEC PG Operator (CPO) 0.9.2 via Helm into a minikube cluster with pod anti-affinity disabled for single-node testing, then apply a postgresql custom resource with numberOfInstances set to 2. This creates one leader and one streaming replica managed by Patroni, running PostgreSQL 18.4, achieving HA with a roughly 14-line YAML manifest.

_See how daily.dev surfaces practical Kubernetes and PostgreSQL HA setups as they're published._

### Why would a replica pod stay stuck in Pending state on minikube when deploying a PostgreSQL operator?

The replica stays Pending because the operator's default pod anti-affinity setting spreads replicas across different Kubernetes nodes, and minikube only has a single node available. Setting configKubernetes.enable_pod_antiaffinity=false during the Helm install avoids this, though anti-affinity should stay enabled on real multi-node production clusters.

_Developers debugging Kubernetes scheduling quirks like this can track similar fixes on daily.dev._

## Similar posts on daily.dev

- [Day to day PostgreSQL on Kubernetes: Resize, Scale, and Upgrade](https://daily.dev/posts/day-to-day-postgresql-on-kubernetes-resize-scale-and-upgrade-yovtdlqzq) · CYBERTEC PostgreSQL · 2 upvotes · 0 comments
- [Introducing the CYBERTEC PG Operator](https://daily.dev/posts/introducing-the-cybertec-pg-operator-r5famrp9v) · CYBERTEC PostgreSQL · 2 upvotes · 0 comments
- [How to Deploy Postgres to Kubernetes Cluster](https://daily.dev/posts/how-to-deploy-postgres-to-kubernetes-cluster-acqpi1qcx) · DigitalOcean Community · 3 upvotes · 1 comments
- [Running OpenBao on Kubernetes with a CloudNativePG PostgreSQL backend](https://daily.dev/posts/running-openbao-on-kubernetes-with-a-cloudnativepg-postgresql-backend-y9jzjlzm1) · CNCF · 1 upvotes · 0 comments
- [K3s: A Better Way to Deploy a Docker App to a Linux Server](https://daily.dev/posts/k3s-a-better-way-to-deploy-a-docker-app-to-a-linux-server-p8llrvwh7) · Atomic Spin · 16 upvotes · 1 comments

---

Tags: [#kubernetes](https://daily.dev/tags/kubernetes), [#database](https://daily.dev/tags/database), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/highly-available-postgresql-on-kubernetes-in-10-minutes-72lxmcugy)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Highly Available PostgreSQL on Kubernetes in 10 Minutes","url":"https://daily.dev/posts/highly-available-postgresql-on-kubernetes-in-10-minutes-72lxmcugy","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/highly-available-postgresql-on-kubernetes-in-10-minutes-72lxmcugy"},"datePublished":"2026-08-18T08:45:14.791Z","dateModified":"2026-09-14T07:17:49.300Z","description":"A step-by-step walkthrough shows how to deploy a highly available PostgreSQL cluster on Kubernetes using the CYBERTEC PG Operator (CPO), running PostgreSQL...","image":"https://media.daily.dev/image/upload/s--HRgLpUt6--/f_auto/v1722860399/public/Placeholder%2003","thumbnailUrl":"https://media.daily.dev/image/upload/s--HRgLpUt6--/f_auto/v1722860399/public/Placeholder%2003","isAccessibleForFree":true,"articleSection":"CYBERTEC PostgreSQL","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"CYBERTEC PostgreSQL","logo":"https://media.daily.dev/image/upload/s--T-0b7qSy--/f_auto/v1720886268/logos/cybertec_postgresql","url":"https://daily.dev/sources/cybertec_postgresql"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/highly-available-postgresql-on-kubernetes-in-10-minutes-72lxmcugy","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":8},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"kubernetes,database,postgresql","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"CYBERTEC PostgreSQL","item":"https://daily.dev/sources/cybertec_postgresql"},{"@type":"ListItem","position":3,"name":"Highly Available PostgreSQL on Kubernetes in 10 Minutes"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/highly-available-postgresql-on-kubernetes-in-10-minutes-72lxmcugy#faq","mainEntity":[{"@type":"Question","name":"How do I set up a highly available PostgreSQL cluster on Kubernetes using minikube?","acceptedAnswer":{"@type":"Answer","text":"Install the CYBERTEC PG Operator (CPO) 0.9.2 via Helm into a minikube cluster with pod anti-affinity disabled for single-node testing, then apply a postgresql custom resource with numberOfInstances set to 2. This creates one leader and one streaming replica managed by Patroni, running PostgreSQL 18.4, achieving HA with a roughly 14-line YAML manifest. See how daily.dev surfaces practical Kubernetes and PostgreSQL HA setups as they're published."}},{"@type":"Question","name":"Why would a replica pod stay stuck in Pending state on minikube when deploying a PostgreSQL operator?","acceptedAnswer":{"@type":"Answer","text":"The replica stays Pending because the operator's default pod anti-affinity setting spreads replicas across different Kubernetes nodes, and minikube only has a single node available. Setting configKubernetes.enable_pod_antiaffinity=false during the Helm install avoids this, though anti-affinity should stay enabled on real multi-node production clusters. Developers debugging Kubernetes scheduling quirks like this can track similar fixes on daily.dev."}}]}
```

