Let’s create a Postgresql database using Helm and ROBIN Storage. In the Cloud Shell run the following command. The command will install Postgresql. We are setting the storageClass to robin-0-3 to benefit from data management capabilities ROBIN Storage brings.
Before proceeding, let us make sure all necessary workloads (pods) are running properly. Click on the “Workloads” tab on the left-hand panel, and wait for the status of all workloads to be shown as ”OK” with a green check next to them.
Get Service IP address of our PostgreSQL database.
Get Password of our PostgreSQL database from Kubernetes Secret.
Adding data to the Postgresql database
We will use movie data to load data into our PostgreSQL database.
Let us create a database “testdb” and connect to “testdb”.
Let’s create a table named “movies”.
Let’s add 9 movies to the “movies” table.
To see the movies added to the “movies” table, run the following command.
You should see an output similar to the following:
We have now deployed a PostgreSQL database on GKE with a table and some sample data.
To benefit from data management capabilities ROBIN brings, such as taking snapshots, making clones, and creating backups, we have to register this PostgreSQL Helm release as an application with ROBIN.
Registering the PostgreSQL Helm release as an application
Registering this PostgreSQL Helm release as an application will enable ROBIN map and track all resources associated with the Helm release for this PostgreSQL database. To register the Helm release as an application, run the following command.
Let’s verify ROBIN is now tracking our Postgresql Helm release as a single entity (app).
You should see an output similar to this.
We have successfully registered our Helm release as an app called “myfilms”.
This concludes the Deploy PostgreSQL on GKE tutorial. Now that we have deployed the PostgreSQL database, loaded data, and registered the PostgreSQL Helm release with ROBIN, we can create a PostgreSQL database snapshot and create a PostgreSQL clone including app plus data.