Skip to content

IBM/perform-crud-operations-using-crunchy-Postgresaql-for-kubernetes-operator-rhm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

abstract authors completed_date components draft excerpt keywords last_updated primary_tag pta pwg related_content related_links runtimes series services subtitle tags title translators type
name email
Rahul Reddy Ravipally
raravi86@in.ibm.com
name email
Manoj Jahgirdar
manoj.jahgirdar@in.ibm.com
name email
Srikanth Manne
srikanth.manne@in.ibm.com
name email
Manjula G. Hosurmath
mhosurma@in.ibm.com
2020-07-03
slug name url type
Crunchy PostgreSQL for Kubernetes
Crunchy PostgreSQL for Kubernetes
component
slug name url type
redhat-marketplace
Red Hat Marketplace
component
true|false
type slug
announcements|articles|blogs|patterns|series|tutorials|videos
title url description
type slug
name email
tutorial

Perform CRUD operations using Crunchy PostgreSQL for Kubernetes Operator on Red Hat Marketplace

In this tutorial, we demonstrate how to install and get started using the Crunchy Postgres operator operator from RedHat Marketplace (RHM) and also we will learn how to Perform CRUD operations using Crunchy PostgreSQL for Kubernetes Operator hosted on Red Hat marketplace using python runtime and Jupyter notebook.

About Crunchy PostgreSQL for Kubernetes Operator

Crunchy PostgreSQL for OpenShift Container Platform (OCP) includes Crunchy PostgreSQL Operator and Crunchy PostgreSQL Container Suite supporting hybrid cloud, open source PostgreSQL-as-a-Service. Learn more. The postgres-operator is a controller that runs within a Kubernetes cluster that provides a means to deploy and manage PostgreSQL clusters. Use the postgres-operator to:

  • deploy PostgreSQL containers including streaming replication clusters
  • scale up PostgreSQL clusters with extra replicas
  • add pgpool, pgbouncer, and metrics sidecars to PostgreSQL clusters
  • apply SQL policies to PostgreSQL clusters
  • assign metadata tags to PostgreSQL clusters
  • maintain PostgreSQL users and passwords
  • perform minor upgrades to PostgreSQL clusters
  • load simple CSV and JSON files into PostgreSQL clusters
  • perform database backups

Learning objectives

When you have completed this tutorial, you will understand how to:

  • Deploy CrunchyDB Operator on OpenShift Cluster
  • Create a CrunchyDB cluster and database
  • Access the cluster on your localhost
  • Perform Create, Read, Update and Delete Operations on CrunchyDB

Estimated time

Completing this tutorial should take about 30 minutes.

Pre-requisites

  1. Red Hat Marketplace Account.
  2. IBM Managed Red Hat OpenShift Cluster.
  3. For all operators being installed from RHM, IBM managed ROKS OpenShift cluster version 4.3 or higher is mandatory. Please set up Classic cluster using the instructions from this URL: Setting up OpenShift Cluster
  4. OC & kubectl CLI.

Steps

Step 1: Install the CrunchyDB Operator from Red Hat Marketplace on OpenShift Cluster

Step 2: Perform CRUD Operations on CrunchyDB using python

  • Once we have the CrunchyDB UP and running, user and database created, we can now explore the CRUD operations on Crunchy PostgreSQL in a python runtime using Jupyter Notebook.

  • In Terminal run the following command to port forward 5432 port from the OpenShift cluster which we will be using in our Jupyter Notebook to establish a connection with the Crunchy PostgreSQL instance.

$ kubectl port-forward -n pgo svc/hippo 5432:5432 
Forwarding from 127.0.0.1:5432 -> 5432
Forwarding from [::1]:5432 -> 5432

  • You can now follow the notebook instructions for more details on what is happening in each cell.

  • After we have execuited the notebook, we can verify the table in the pgAdmin 4 console.

    • To access pgAdmin 4, you can set up a port-forward to the Service, which follows the pattern <clusterName>-pgadmin, to port 5050:
$ kubectl port-forward -n pgo svc/hippo-pgadmin 5050:5050 
Forwarding from 127.0.0.1:5050 -> 5050
Forwarding from [::1]:5050 -> 5050
  • In the pgAdmin 4 console, expand your cluster (eg: in our case cpdemo), expand Databases, expand database_name, expand Schemas, expand username (eg: in our case hippo), expand Tables, you can now see the accounts table that we created from the notebook. Right click on the accounts table and select View/Edit Data > All Rows and the table with all rows will be displayed as shown.

NOTE: You can view this table after each CRUD operation performed in notebook in order to visualize the changes.

Summary

In this tutorial you have learnt the basics of how to use Crunchy postgreSQL for kubernetes Operator deployed on OpenShift Cluster. You have learnt how to perform CRUD operations using the Crunchy postgreSQL for kubernetes Operator in python.

Reference

The documentation for Crunchy PostgreSQL Operator is available at,

About

Perform CRUD operations using Crunchy PostgreSQL for Kubernetes Operator on Red Hat Marketplace

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •