You are viewing documentation for KubeSphere version:v3.0.0

KubeSphere v3.0.0 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date documentation, see the latest version.

Deploy PostgreSQL on KubeSphere

PostgreSQL is a powerful, open-source object-relational database system which is famous for reliability, feature robustness, and performance.

This tutorial walks you through an example of how to deploy PostgreSQL from the App Store of KubeSphere.

Prerequisites

  • Please make sure you enable the OpenPitrix system.
  • You need to create a workspace, a project, and a user account (project-regular) for this tutorial. The account needs to be a platform regular user and to be invited as the project operator with the operator role. In this tutorial, you log in as project-regular and work in the project demo-project in the workspace demo-workspace. For more information, see Create Workspaces, Projects, Accounts and Roles.

Hands-on Lab

Step 1: Deploy PostgreSQL from the App Store

  1. On the Overview page of the project demo-project, click App Store in the top left corner.

    click-app-store

  2. Find PostgreSQL and click Deploy on the App Info page.

    postgresql-in-app-store

    deploy-postgresql

  3. Set a name and select an app version. Make sure PostgreSQL is deployed in demo-project and click Next.

    deploy-postgresql-2

  4. In App Config, specify persistent volumes for the app and record the username and the password which will be used later to access the app. When you finish, click Deploy.

    set-config

    Note

    To specify more values for PostgreSQL, use the toggle switch to see the app’s manifest in YAML format and edit its configurations.
  5. Wait until PostgreSQL is up and running.

    postgresql-ready

Step 2: Access the PostgreSQL Database

To access PostgreSQL outside the cluster, you need to expose the app through a NodePort first.

  1. Go to Services and click the service name of PostgreSQL.

    access-postgresql

  2. Click More and select Edit Internet Access from the drop-down menu.

    edit-internet-access

  3. Select NodePort for Access Method and click OK. For more information, see Project Gateway.

    nodeport

  4. Under Service Ports, you can see the port is exposed, which will be used in the next step to access the PostgreSQL database.

    port-number

  5. Expand the Pod menu under Pods and click the Terminal icon. In the pop-up window, enter commands directly to access the database.

    container-terminal

    postgresql-output

    Note

    You can also use a third-party application such as SQLPro Studio to connect to the database. You may need to open the port in your security groups and configure related port forwarding rules depending on your where your Kubernetes cluster is deployed.
  6. For more information, see the official documentation of PostgreSQL.