project: Setup postgresql backend

Tags kubernetes fluxcd
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: Unistall K3s
  • Setup postgresql backend

    When no flags are used when starting K3s it uses a sqlite backend that’s not very stable and quickly fails. To give us a more sturdy backend let’s use PostgreSQL instead.

    It may have thrown an error if you don’t have PostgreSQL installed, go find the card from an earlier exercise and install postgres on the host machine.

    # logs in as the `postgres` user
    sudo -i -u postgres
    
    # opens the PostgreSQL shell
    psql
    
    # creates the database
    CREATE DATABASE kubernetes;
    
    # creates the user/password
    CREATE USER k3s WITH PASSWORD 'yourpassword';
    
    # allows the user access to the databse
    GRANT ALL PRIVILEGES ON DATABASE kubernetes TO k3s;
    
    # exits the PostgreSQL shell
    exit
    
    # logs back to your instance user
    logout
    

    RAW CONTENT URL