Skip to content

CloudnativePG Installation

CloudnativePG is the Kubernetes operator that covers the full lifecycle of a highly available PostgreSQL database cluster with a primary/standby architecture.

CloudnativePG will be installed on 🟢 Management Kubernetes Clusters.

  1. Connect to 🟢 Management Kubernetes Cluster ; _i.e w/ Kubeconfig File.

    Set Kubeconfig File

    Ensure you have defined and loaded your Global Shell Variables as described in Shell Variables.

    Terminal window
    source $HOME/opstella-installation/shell-values/kubernetes/management_cluster.vars.sh
    Terminal window
    export KUBECONFIG="$HOME/opstella-installation/kubeconfigs/management_cluster.yaml"
  2. Create Namespace for CloudnativePG Controller

    Terminal window
    kubectl create namespace cnpg-system
  3. Add CloudnativePG Helm Repository

    Terminal window
    helm repo add cnpg https://cloudnative-pg.github.io/charts
    helm repo update
  4. Create Helm Values Configurations for Operator

    Terminal window
    cat <<EOF > $HOME/opstella-installation/helm-values/cnpg-full-values.yaml
    # CloudNativePG Operator Helm Values (Chart v0.27.0)
    replicaCount: 1
    image:
    repository: ghcr.io/cloudnative-pg/cloudnative-pg
    pullPolicy: IfNotPresent
    # tag: "" # Overrides default tag
    # Enable CRD creation by the chart
    crds:
    create: true
    # Operator configuration
    config:
    create: true
    name: cnpg-controller-manager-config
    clusterWide: true
    monitoring:
    podMonitorEnabled: false # Enabled per-cluster in the Cluster manifest usually
    # Monitoring / Prometheus Operator integration
    monitoring:
    podMonitorEnabled: false # This is for monitoring the operator itself, usually not needed unless debugging operator
    EOF
  5. Create Helm Values Configurations for Barman Plugin

    Terminal window
    cat <<EOF > $HOME/opstella-installation/helm-values/cnpg-barman-full-values.yaml
    # Production overrides for CNPG Barman Cloud Plugin
    # Version: 0.4.0
    # Resource Limits for Production
    resources:
    limits:
    cpu: 200m
    memory: 256Mi
    requests:
    cpu: 100m
    memory: 128Mi
    EOF
  6. Install CloudnativePG Helm Release

    Terminal window
    helm upgrade --install cnpg cnpg/cloudnative-pg \
    --version 0.27.0 \
    --namespace cnpg-system \
    -f $HOME/opstella-installation/helm-values/cnpg-full-values.yaml
  7. Install CloudnativePG Barman Plugin Helm Release

    Terminal window
    helm upgrade --install cnpg-plugin-barman cnpg/plugin-barman-cloud \
    --version 0.4.0 \
    --namespace cnpg-system \
    -f $HOME/opstella-installation/helm-values/cnpg-barman-full-values.yaml
  1. Get Pod Status - CloudnativePG Controller

    Terminal window
    kubectl get pods -n cnpg-system

    💡 CloudnativePG Controller and Barman Plugin should be Running

    NAME READY STATUS RESTARTS AGE
    ... (deducted)
    cnpg-cloudnative-pg-XXXXXXXX-YYYYYY 1/1 Running 0 XdXh
    cnpg-plugin-barman-XXXXXXXX-YYYYYY 1/1 Running 0 XdXh

Finished?

Use the below navigation to proceed