KubeBlocks
BlogsKubeBlocks Cloud
⌘K
​
Overview
Quickstart

Operations

Lifecycle Management
Vertical Scaling
Horizontal Scaling
Volume Expansion
Manage PostgreSQL Services
Minor Version Upgrade
Modify PostgreSQL Parameters
PostgreSQL Switchover
Decommission PostgreSQL Replica
Recovering PostgreSQL Replica

Backup And Restores

Create BackupRepo
Create Full Backup
Scheduled Backups
Scheduled Continuous Backup
Restore PostgreSQL Cluster
Restore with PITR

Custom Secret

Custom Password
Custom Password Policy

TLS

PostgreSQL Cluster with TLS
PostgreSQL Cluster with Custom TLS

Monitoring

Observability for PostgreSQL Clusters
FAQs

tpl

  1. 1. Use ETCD as Patroni DCS

PostgreSQL FAQs

1. Use ETCD as Patroni DCS

KubeBlocks PostgreSQL uses the Kubernetes API itself as DCS (Distributed Config Store) by default. But when the control plane is under extreme high load, it may lead to unexpected demotion of the primary replica. And it's recommended to use ETCD as DCS in such extreme cases.

apiVersion: apps.kubeblocks.io/v1 kind: Cluster metadata: name: pg-cluster-etcd namespace: demo spec: terminationPolicy: Delete clusterDef: postgresql topology: replication componentSpecs: - name: postgresql serviceVersion: "16.4.0" env: - name: DCS_ENABLE_KUBERNETES_API # unset this env if you use zookeeper or etcd, default to empty - name: ETCD3_HOST value: 'etcd-cluster-etcd-headless.demo.svc.cluster.local:2379' # where is your etcd? # - name: ZOOKEEPER_HOSTS # value: 'myzk-zookeeper-0.myzk-zookeeper-headless.demo.svc.cluster.local:2181' # where is your zookeeper? replicas: 2 resources: limits: cpu: "0.5" memory: "0.5Gi" requests: cpu: "0.5" memory: "0.5Gi" volumeClaimTemplates: - name: data spec: storageClassName: "" accessModes: - ReadWriteOnce resources: requests: storage: 20Gi

The key fields are:

  • DCS_ENABLE_KUBERNETES_API: Unset this env to use ETCD or ZooKeeper as DCS
  • ETCD3_HOST: The host of ETCD cluster

You can also use ZooKeeper as DCS by unsetting DCS_ENABLE_KUBERNETES_API and setting ZOOKEEPER_HOSTS to the host of ZooKeeper cluster.

KubeBlocks has ETCD and ZooKeeper Addons in the kubeblocks-addons repository. You can refer to the following links for more details.

  • https://github.com/apecloud/kubeblocks-addons/tree/main/examples/etcd
  • https://github.com/apecloud/kubeblocks-addons/tree/main/examples/zookeeper

You can shell into one of the etcd container to view the etcd data, and view the etcd data with etcdctl.

etcdctl get /service --prefix

© 2025 ApeCloud PTE. Ltd.