VMware Tanzu SQL, Now GA for Kubernetes: A Consistent Postgres Experience Everywhere

November 10, 2020 Jing Li

Data services—such as caches, messaging queues, and relational databases—are the backbone of applications. And when it comes to relational databases, Postgres is a pretty popular option. Its killer feature is its versatility. Natively and through plugins, Postgres supports a wide variety of data types, formats, and programming languages, which makes it useful for all kinds of applications, including text, geospatial, graph, and more. With Postgres, organizations have the potential to reduce the need for specialized databases, decreasing operational overhead.

To run Postgres effectively, you need higher availability, instant scalability, operational simplicity, and the ability to run on-premises and across clouds. Perhaps most importantly, you need Postgres delivered on-demand via self-service. The idea of requesting an instance via a ticket is a non-starter these days.

Running Postgres—and indeed, any managed database service in the cloud—is one way to provide the benefits of self-service deployment flexibility, speed, and elasticity. However, running in the public cloud often means giving up a degree of control over your data. Meanwhile, the ability to recover from outages and any other issues depends on cloud provider priorities. So how can developers get the same ease of use from a managed service, on the infrastructure of choice, while maintaining control over data? How can platform teams maintain control over policies and configurations, with consistent security? You can do all of that using VMware Tanzu SQL with Postgres for Kubernetes.

Tanzu SQL and Kubernetes: Better together

VMware has deep expertise with Postgres. To support our own reliance on the software, we employ three committers and six contributors. And for more than 15 years, we have solved the problem of parallelizing Postgres for analytics with our popular VMware Tanzu Greenplum data warehouse. We’ve also used that expertise to develop an operator that makes Postgres easy to deploy on Kubernetes. VMware Tanzu SQL with Postgres for Kubernetes, now generally available, provides a DevOps-friendly experience for Postgres, both on-premises and in the public, private, or hybrid cloud. You can download Tanzu Postgres via the Tanzu Network.

VMware developed Tanzu Postgres to work with Kubernetes so as to be able to implement essential database management functionality across fleets of Postgres deployments, including:

Self-service deployment – Tanzu Postgres is designed to be configured and deployed with a single command. With access to certified software packages, updates, bug fixes, and security patches, along with 24x7 technical support, Tanzu Postgres combines enterprise readiness with self-service ease.

Automated management – The life cycle of each PostgreSQL database instance is fully managed by a centralized Postgres operator on your Kubernetes cluster. Routine management operations such as deployment, failover, and scaling are built into the operator. Once the desired management tasks are configured, they can be carried out to every database instance managed by the operator.

Elastic scale – Among the key benefits of containerized applications are their flexibility and scalability. This also extends to containerized databases. Running Postgres instances can be easily scaled horizontally or vertically with simple Kubernetes commands. Your data is kept safe via persistent volume claims (PVCs).

Consistent operation – The deployment and management experience is the same across any Kubernetes platform. That means commands such as “helm install postgres-operator" and “kubectl create -f postgres-db” stay the same regardless of the underlying infrastructure, be it on-prem or cloud.

Now let’s take a closer look at how all these attributes work in real life!

Getting Started with Tanzu SQL

We’ll start by walking through how to set up a highly available Postgres cluster on a Kubernetes cluster. 

Installing the Postgres operator

Tanzu Postgres ships as a pair of container images—an operator image that automates deployment and management, and an image containing the database and extensions.

You can store your Tanzu PostgreSQL images in the container registry of your choice. The images can be certified, scanned for vulnerabilities, and made accessible to teams based on access policies. The Postgres operator can be installed easily via Helm:

helm install postgres-operator operator/

Once deployed to your Kubernetes cluster, the Tanzu Postgres operator lets you manage the full life cycle of all your PostgreSQL instances. Here’s a look at the architecture:

To configure PostgreSQL instances for deployment, simply set your parameters through YAML. You can deploy instances separately, using a specific file for each, or deploy fleets at the same time. Here’s a sample YAML configuration:

kind: PostgresInstance
metadata:
  name: my-postgres 
spec:
  memory: 800Mi 
  cpu: "0.8"   
  storageClassName: standard   
  storageSize: 100M   
  pgConfig:
    dbname: testdb     
    username: pgadmin
  serviceType: LoadBalancer 
  highAvailability:
    Enabled: True

Once the YAML configuration is complete, deploy the instances via kubectl commands:

kubectl create --save-config my-pg-instance.yaml

The Postgres operator provisions the required pods to run your PostgreSQL database cluster. The operator also monitors status and triggers automated failover between Postgres nodes. You will see pods spin up like so:

NAME                              READY   STATUS    RESTARTS   AGE
pod/my-pg-instance-0              1/1     Running    0         6s
pod/my-pg-instance-1              1/1     Running    0         6s
pod/my-pg-instance-monitor-0      1/1     Running    0         6s

The data is kept in persistent volume claims and is resilient across any database or Kubernetes outage:

NAMESPACE     NAME                      STATUS  VOLUME CAPACITY   
postgres-db   pgdata-my-pg-instance-1   Bound   pvc-xxx 1G          
postgres-db   pgdata-my-pg-instance-0   Bound   pvc-yyy 1G     

Here you can see a demonstration of automated failover between Postgres nodes:

Automated failover of a Postgres HA cluster on Kubernetes

You can also easily scale up your Postgres instances; just update the resource configuration. You can also scale out by adding replicas to enable automated failover. In either case, you can scale by making changes to the deployment YAML. Then use the same kubectl commands to update the deployed pods:

kubectl apply -f my-pg-instance.yaml

Make updates to compute or storage resources as usage warrants. These updates are done in place, to the running pods, and allow you to scale based on need with ease.

 Updating from a single node configuration to an HA configuration

Get started today!

Tanzu SQL is officially supported on VMware Tanzu Kubernetes Grid, VMware Tanzu Application Service, VMware vSphere 7, and Google Kubernetes Engine. And it’s deployable on any certified Kubernetes runtime, including the OpenShift Container Platform, in minutes. 

Tanzu SQL is included with the VMware Tanzu Advanced Edition of the Tanzu Portfolio.

Ready to try out Tanzu SQL with Postgres? Review the Tanzu SQL with Postgres for Kubernetes product documentation and download Tanzu SQL with Postgres for Kubernetes from the Tanzu Network today.

No Previous Articles

Next
Announcing the General Availability of VMware Tanzu Kubernetes Grid 1.2
Announcing the General Availability of VMware Tanzu Kubernetes Grid 1.2

We are excited to announce the general availability of VMware Tanzu Kubernetes Grid 1.2 with support for Ku...