Skip to content
logo
Percona Operator for PostgreSQL
Install on Minikube
Initializing search
    percona/k8spg-docs
    percona/k8spg-docs
    • Welcome
      • System Requirements
      • Design and architecture
      • Comparison with other solutions
      • Install on Minikube
      • Install on Google Kubernetes Engine (GKE)
      • Install with Helm
      • Generic Kubernetes installation
      • Install on OpenShift
      • Application and system users
      • Changing PostgreSQL Options
      • Anti-affinity and tolerations
      • Transport Encryption (TLS/SSL)
      • Telemetry
      • Backup and restore
      • Upgrade Percona Distribution for PostgreSQL and the Operator
      • Horizontal and vertical scaling
      • Monitor with Percona Monitoring and Management (PMM)
      • Restart or pause the cluster
      • Deploy a standby cluster for Disaster Recovery
      • Provide Percona Operator for PostgreSQL single-namespace and multi-namespace deployment
      • Use PostgreSQL tablespaces with Percona Operator for PostgreSQL
      • Custom Resource options
      • Operator installation options
      • Percona certified images
      • Frequently Asked Questions
      • Release notes index
      • Percona Operator for PostgreSQL 1.3.0 (2022-08-04)
      • Percona Operator for PostgreSQL 1.2.0 (2022-04-06)
      • Percona Operator for PostgreSQL 1.1.0 (2021-12-07)
      • Percona Operator for PostgreSQL 1.0.0 (2021-10-07)
      • Percona Operator for PostgreSQL 0.2.0 (2021-08-12)
      • Percona Operator for PostgreSQL 0.1.0 (2021-05-10)

    Install Percona Distribution for PostgreSQL on Minikube¶

    Installing the Percona Operator for PostgreSQL on minikube is the easiest way to try it locally without a cloud provider. Minikube runs Kubernetes on GNU/Linux, Windows, or macOS system using a system-wide hypervisor, such as VirtualBox, KVM/QEMU, VMware Fusion or Hyper-V. Using it is a popular way to test the Kubernetes application locally prior to deploying it on a cloud.

    The following steps are needed to run Percona Operator for PostgreSQL on minikube:

    1. Install minikube, using a way recommended for your system. This includes the installation of the following three components:

      1. kubectl tool,
      2. a hypervisor, if it is not already installed,
      3. actual minikube package

      After the installation, run minikube start command. Being executed, this command will download needed virtualized images, then initialize and run the cluster. After minikube is successfully started, you can optionally run the Kubernetes dashboard, which visually represents the state of your cluster. Executing minikube dashboard will start the dashboard and open it in your default web browser.

    2. The first thing to do is to add the pgo namespace to Kubernetes, not forgetting to set the correspondent context for further steps:

      $ kubectl create namespace pgo
      $ kubectl config set-context $(kubectl config current-context) --namespace=pgo
      

      Note

      To use different namespace, you should edit all occurrences of the namespace: pgo line in both deploy/cr.yaml and deploy/operator.yaml configuration files.

      If you use Kubernetes dashboard, choose your newly created namespace to be shown instead of the default one:

      image

    3. Deploy the operator with the following command:

      $ kubectl apply -f https://raw.githubusercontent.com/percona/percona-postgresql-operator/v1.3.0/deploy/operator.yaml
      
    4. Deploy Percona Distribution for PostgreSQL:

      $ kubectl apply -f https://raw.githubusercontent.com/percona/percona-postgresql-operator/v1.3.0/deploy/cr-minimal.yaml
      

      This deploys PostgreSQL on one node, because deploy/cr-minimal.yaml is for minimal non-production deployment. For more configuration options please see deploy/cr.yaml and Custom Resource Options.

      Creation process will take some time. The process is over when both operator and replica set pod have reached their Running status:

      $ kubectl get pods
      
      Expected output
      NAME                                                    READY   STATUS      RESTARTS   AGE
      backrest-backup-minimal-cluster-dcvkw                   0/1     Completed   0          68s
      minimal-cluster-6dfd645d94-42xsr                        1/1     Running     0          2m5s
      minimal-cluster-backrest-shared-repo-77bd498dfd-9msvp   1/1     Running     0          2m23s
      minimal-cluster-pgbouncer-594bf56d-kjwrp                1/1     Running     0          84s
      pgo-deploy-lnbv7                                        0/1     Completed   0          4m14s
      postgres-operator-6c4c558c5-dkk8v                       4/4     Running     0          3m37s
      

      You can also track the progress via the Kubernetes dashboard:

      image

    5. During previous steps, the Operator has generated several secrets, including the password for the pguser user, which you will need to access the cluster.

      Use kubectl get secrets command to see the list of Secrets objects(by default Secrets object you are interested in has cluster1-pguser-secret name). Then kubectl get secret cluster1-pguser-secret -o yaml will return the YAML file with generated secrets, including the password which should look as follows:

      ...
      data:
        ...
        password: cGd1c2VyX3Bhc3N3b3JkCg==
      

      Here the actual password is base64-encoded, and echo 'cGd1c2VyX3Bhc3N3b3JkCg==' | base64 --decode will bring it back to a human-readable form (in this example it will be a pguser_password string).

    6. Check connectivity to a newly created cluster.

      Run new Pod to use it as a client and connect its console output to your terminal (running it may require some time to deploy). When you see the command line prompt of the newly created Pod, run psql tool using the password obtained from the secret. The following command will do this, naming the new Pod pg-client:

      $ kubectl run -i --rm --tty pg-client --image=perconalab/percona-distribution-postgresql:14.4 --restart=Never -- bash -il
      [postgres@pg-client /]$ PGPASSWORD='pguser_password' psql -h cluster1-pgbouncer -p 5432 -U pguser pgdb
      

      This command will connect you to the PostgreSQL interactive terminal.

      $ psql (14.4)
      Type "help" for help.
      pgdb=>
      

    Contact Us

    For free technical help, visit the Percona Community Forum.

    To report bugs or submit feature requests, open a JIRA ticket.

    For paid support and managed or consulting services , contact Percona Sales.


    Last update: 2023-02-09
    Back to top
    Percona LLC and/or its affiliates, © 2009 - 2022
    Made with Material for MkDocs

    Cookie consent

    We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better.