PostgreSQL running on Kubernetes

Create a unified management with the flexibility of cloud-native production deployment to deploy a personalized database as a service (DBaaS).

By running PostgreSQL database on Kubernetes, you can create a unified management with the flexibility of cloud-native application for production deployment to deploy a personalized database service that is tailored to your specific needs.

For Kubernetes, using Operator allows you to provide additional context to manage stateful applications. When the time to perform include configuration, expansion, availability and user management, Operator also helpful to use open source databases such as PostgreSQL.

Let's explore how to start and run PostgreSQL on Kubernetes.

Install PostgreSQL Operator

The first step will be used in conjunction with PostgreSQL and Kubernetes is to install a Operator. In for  Linux  Quick Start Crunchy system script with the help of, you can at any Crunchy PostgreSQL Operator based on starting and running under Kubernetes open source environment.

Quick Start script has the necessary prerequisites:

Wget tool is installed.
kubectl tool is installed.
In your Kubernetes already defined a StorageClass.
Clusters have permission to access Kubernetes user account to install the Operator of RBAC rules.
A PostgreSQL Operator namespace.
Execute the script will give you a default PostgreSQL Operator deployment, the default assumes that you use dynamic memory and a standard called the StorageClass. This script allows users to employ custom values to override these defaults.

By following command , you can download the quick start script and its permissions set to executable:

wget 
chmod +x ./quickstart.sh

Then you run the Quick Start script:

./examples/quickstart.sh

Prompt you basic information about Kubernetes cluster in the script, it will do the following:
Download Operator profiles
will be $ HOME / .pgouser this file as the default setting
to Kubernetes Deployment deployment Operator
Set your .bashrc file contains Operator environment variable
settings your $ HOME / .bash_completion file pgo bash_completion file
during the execution of the fast startup script, you will be prompted to set up RBAC rules in your Kubernetes cluster. In another terminal, fast boot command your command prompt.

Once the script execution is complete, you will be prompted to set up a port forwarding to PostgreSQL Operator pod. In another terminal, perform this port forwarding operations; this will allow you to execute commands to start PostgreSQL Operator! Enter the following command to try to create a cluster:

pgo create cluster mynewcluster

You can enter the following command to test the health of your cluster:

pgo test mynewcluster

Now, you can manage your PostgreSQL database in Kubernetes the environment! You can find a very comprehensive command in official documents, including expansion, high availability, backup, and so on.

Section of this article refer to the author Crunchy blog written starts to run on Kubernetes PostgreSQL.

Guess you like

Origin blog.csdn.net/weixin_43226231/article/details/89850762