Kubegres is a Kubernetes operator allowing to deploy a cluster of PostgreSql instances with data replication and failover enabled out-of-the box. It brings simplicity when using PostgreSql considering how complex managing stateful-set's life-cycle and data replication could be with Kubernetes.
Kubegres is open source and available on GitHub.
- It creates a cluster of PostgreSql servers with Streaming Replication enabled: it creates a Primary PostgreSql pod and a number of Replica PostgreSql pods and replicates primary's database in real-time to Replica pods.
- It manages failover: if a Primary PostgreSql crashes, it automatically promotes a Replica PostgreSql as a Primary.
- It has a data backup option allowing to dump PostgreSql data regularly in a given volume.
- It provides a very simple YAML with properties specialised for PostgreSql.
- It is resilient, has over 62 automatized tests cases and has been running in production.
- It works with the PostgreSql containers created by the Docker Official Images team. Kubegres uses the standard PostgreSql libraries to manage replication and failover and it does not require a custom Docker image with a set of third party libraries.
- It is portable because compatible with any Docker images which derive from the PostgreSql containers.
Kubegres is fully integrated with Kubernetes' lifecycle as it runs as an operator written in Go. It is minimalist in terms of codebase compared to other open-source Postgres operators. It has the minimal and yet robust required features to manage a cluster of PostgreSql on Kubernetes. We aim keeping this project small and simple.
Among many reasons, there are 5 main ones why we recommend Kubegres:
- Standard: to manage replications, failover and backup, Kubegres is 100% relying on the PostgreSql standard libraries bundled in the PostgreSql containers. It does not ship with any custom or third party libraries to manage those features.
- Small learning curve: if you are already familiar with the standard PostgreSql libraries, you can understand and admin Kubegres easily.
- Secure: all other open source projects that we have evaluated do require their own custom Docker containers which ship with custom libraries. And in order to reduce the attack surface caused by additional dependencies, we have decided to only depend on the PostgreSql containers created and maintained by the Docker Official Images team.
- Portable: the approach above allows Kubegres to be compatible with any containers which derive from those PostgreSql containers.
- Pure Go: Kubegres was entirely written in Go and no additional languages were used (e.g. Python, ...). And it uses the latest Kubebuilder version 3 which is maintained by the official Kubernetes API Machinery Special Interest Group (SIG).
Tell me more
It was developed with the framework Kubebuilder version 3, an SDK for building Kubernetes APIs using CRDs. Kubebuilder is maintained by the official Kubernetes API Machinery Special Interest Group (SIG).