project: Install PostgreSQL

Tags kubernetes
Hard Prerequisites
IMPORTANT: Please review these prerequisites, they include important information that will help you with this content.
  • K8S: Manual App Deployment – Project Overview
  • Soft Prerequisites
  • K8S: Push Docker images to Harbor
  • Now let’s start deploying our application stack with the PostgreSQL database.

    Let’s install PostgreSQL using the Bitnami’s Helm chart.

    # adds the bitnami helm repo
    helm repo add bitnami https://charts.bitnami.com/bitnami
    
    # updates helm index
    helm repo update
    
    # installs the postgresql
    helm install postgresql bitnami/postgresql \
      --set global.postgresql.auth.username=youruser \
      --set global.postgresql.auth.password=yourpassword \
      --set global.postgresql.auth.database=dbname
      
    # lists the helm charts installed
    helm list
    

    The Helm chat will generate a Kubernetes Service with the database address and a Kubernetes Secret with the database password. Let’s find them!

    # gets the postgresql service
    kubectl get svc postgresql
    
    # describes the postgresql secret
    kubectl describe secret postgresql
    

    Based on the commands output, you can use the following addresses to access the database:

    # if the app is on the default Kubernetes namespace
    postgresql:5432
    
    # to access the database from any namespace
    postgresql.default.svc.cluster.local:5432
    

    RAW CONTENT URL