Difficulty: Intermediate
Estimated Time: 10 minutes

Portworx is a software defined persistent storage solution designed and purpose built for applications deployed as containers, via container orchestrators such as Kubernetes, Marathon and Swarm. It is a clustered block storage solution and provides a Cloud-Native layer from which containerized stateful applications programmatically consume block, file and object storage services directly through the scheduler.

In this tutorial, you will learn how to deploy PostgreSQL to Kubernetes and use Portworx Volumes to provide HA capability:

  • Use the Portworx Storage Class to create a PVC with 3 replicas of the data
  • Use a simple YAML file to deploy PostgreSQL using this storage class
  • How to validate data persistence by deleting the PostgreSQL pod

High Level Overview

First we will deploy PostgreSQL with replication factor of 3 and with io_profile=db. To learn more about io_profile settings please visit our docs page.

PostgreSQL using PX Volume

Then we're going run a benchmark to create 5,000,000 rows in the database. Before simulating a server failure by deleting the pod running PostgreSQL.

Simulate Server Failure

Finally, when the pod come back up Portworx works with the Kubernetes scheduler to make sure it gets scheduled where the data is available.

Postgres Pod is reattached to it's data

Other things you should know

To learn more about how why running PostgreSQL on Portworx is a great idea take a look at the following links:

This scenario assumes you have already covered the following scenarios:

Thank you for trying the playground. To view all our scenarios, go here

To learn more about Portworx, below are some useful references.

Don’t stop now! The next scenario will only take about 10 minutes to complete.

PostgreSQL all in one demo with Portworx and STORK on Kubernetes

Step 1 of 11

Wait for Kubernetes & Portworx to be ready

First we need to wait for Kubernetes and Portworx to be ready. Be patient, this is not a very high performance environment, just a place to learn something :-)

Step: Wait for Kubernetes to be ready

Click the below section which waits for all Kubernetes nodes to be ready.

watch kubectl get nodes

When all 4 nodes show status Running then hit clear to ctrl-c and clear the screen.

Step: Wait for Portworx to be ready

Watch the Portworx pods and wait for them to be ready on all the nodes. This can take a few minutes since it involves pulling multiple docker images. You will see 'No resources found' until all images are pulled.

watch kubectl get pods -n kube-system -l name=portworx -o wide

When all the pods show STATUS Running and READY 1/1 then hit clear to ctrl-c and clear the screen.

Now that we have the Portworx cluster up, let's proceed to the next step !