zephyrproject-rtos / infrastructure

Zephyr Project Infrastructure Management
1 stars 1 forks source link

Deploy PostgreSQL cluster on Kubernetes #124

Open stephanosio opened 1 year ago

stephanosio commented 1 year ago

Deploy a PostgreSQL cluster on Kubernetes with replication enabled.

stephanosio commented 1 year ago

Re: Deployment options

There are many different ways to deploy a PostgreSQL cluster onto Kubernetes: custom manifest using containerised PostgreSQL installation, Helm chart, Kubernetes operator, ...).

  1. Custom manifest using containerised PostgreSQL installation
    • While the PostgreSQL binaries are nicely packaged, the cluster configurations and orchestration need to be manually managed.
    • Manually defining and managing the stateful sets and replication is very high maintenance.
    • e.g. https://hub.docker.com/_/postgres
  2. Helm chart
    • This is marginally better than the custom manifest option because it only provides a "template manifest", and the cluster configuration and orchestration still need to be manually managed.
    • e.g. https://bitnami.com/stack/postgresql/helm
  3. Kubernetes operator
    • Custom Kubernetes workflows that automatically configure and orchestrate the cluster components (scaling, replication, ...).
    • This is the approach currently used for deploying our multi-tier highly available Elasticsearch cluster to Kubernetes -- the initial deployment and replica orchestration were "automagically" handled and only minimal configuration was required.

In order to reduce the maintenance overhead and to ensure that our deployment follows the widely accepted best practices, the "Kubernetes operator" option should be used if available and feasible.

There seem to be quite a few different Kubernetes operator implementations available for PostgreSQL; but, none of them are from the official PostgreSQL project.

TODO: Evaluate and list PostgreSQL Kubernetes operator candidates.