Postgres And Kubernetes Together In Harmony
Written by Nikos Vaggalis   
Thursday, 17 October 2024

Yes, they can coexist thanks to CloudNativePG, the PostgreSQL Operator for Kubernetes. Furthermore, if you want to try before you buy you can, thanks to the new learning environment, CNPG Playground.

The big obstacle in running data driven stateful applications on Kubernetes was that Kubernetes couldn't play along with state. Not anymore. As things progressed the question shifted from
"can Kubernetes work with databases" to "yes they can, but how?".

As far as PostgreSQL is concerned, CloudNativePG by EDB has got the case covered. CloudNativePG is designed to seamlessly manage PostgreSQL databases within Kubernetes environments, covering the entire operational lifecycle from initial deployment to ongoing maintenance, so that you can bring on your database workload.

There are many advantages to it, but CloudNativePG's main plus point is that it automates the steps that a human operator would do to deploy and to manage a Postgres database inside Kubernetes, including automated failover, simplifying cluster management in cloud-native environments. What's more, despite being developed by EDB, it's released as open source under Apache License 2. 0, which eliminates vendor lock-in.

Of course, setting up such a beast would require carefully planning as well as training. Adopter fear not since things get now simplified with the introduction of CNPG Playground the local learning environment for Postgres in Kubernetes. Its mission is to :

By using Docker and Kind, it simulates real-world scenarios, enabling developers and DBAs to experiment with PostgreSQL replication across two clusters. Designed for hands-on learning, CNPG Playground provides an accessible entry point for testing configurations and features, with plans for future enhancements and community collaboration.

In other words, it helps developers and DBAs to start experimenting with running PostgreSQL in Kubernetes and in an emulated CloudNativePG environment so that they can test configurations and explore features such as high availability without the need of any cloud infrastructure; that is before actually deploying the real thing.

The environment that CNPG Playground emulates comprises of a two-region infrastructure (EU and US), with each region containing:

  • An object storage service powered by MinIO containers
  • A Kubernetes cluster, deployed using Kind, consisting of:
    • One control plane node
    • One node for infrastructure components
    • One node for applications
    • Three nodes dedicated to PostgreSQL

For setting it up, there's a few pre-requirements to get started. You need to be in possession of:

  • Docker
  • Git
  • Kubectl
  • Kind

Then simply run the following script:

. /scripts/setup. sh

Now you can connect to the Kubernetes clusters, inspect the nodes and do your experiments without the hassle and fear of bringing down an environment in production.

 cloudnativepg

More Information

CloudNativePG

CloudNativePG playground

Related Articles

It's 2024. Why Does PostgreSQL Still Dominate?

Learn Kubernetes by Example

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


The Feds Want Us To Move On From C/C++
13/11/2024

The clamour for safe programming languages seems to be growing and becoming official. We have known for a while that C and C++ are dangerous languages so why has it become such an issue now and is it  [ ... ]



Go At Highest Rank Ever in TIOBE Index
20/11/2024

Go is currently in 7th place in the TIOBE Index for November 2024. Not only is this is the highest position it has ever had, it's percentage rating is almost equal to its all-time-high. Will Go contin [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

 

Last Updated ( Thursday, 17 October 2024 )