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 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2020-07-03 |
|
true|false |
|
|
|
|
tutorial |
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.
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
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
Completing this tutorial should take about 30 minutes.
- Red Hat Marketplace Account.
- IBM Managed Red Hat OpenShift Cluster.
- 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
- OC & kubectl CLI.
- Steps to Deploy CruchyDB Operator from Red Hat Marketplace on a OpenShift Cluster can be found here,
-
Once we have the CrunchyDB UP and running,
user
anddatabase
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
-
We will be working with Jupyter Notebook, you can use tools like Anaconda to open the Jupyter Notebook or install Jupyter Notebook from python-pip.
-
Download and open the notebook CrunchyDB CRUD Operations.ipynb in your local machine.
-
Click on the Cell tab and click on Run All as shown.
-
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 port5050
:
- To access pgAdmin 4, you can set up a
$ 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 casecpdemo
), expandDatabases
, expanddatabase_name
, expandSchemas
, expandusername
(eg: in our casehippo
), expandTables
, you can now see theaccounts
table that we created from the notebook. Right click on theaccounts
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.
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.
The documentation for Crunchy PostgreSQL Operator is available at,