This is a guide to how you can connect to PostgreSQL from Microk8s pods. I will be using Ubuntu server 20.04, Postgres 12 and mircok8s version 1.18.4.
Install Get Microk8s using snap:
snap install microk8s --classic Get PostgreSQL using apt:
sudo apt install postgresql postgresql-contrib Configure Before we can connect to the PostgreSQL instance we need to start a cluster and enable some addons, and configure postgres to listen for connections from Microk8s.
I recently decided that my goal of creating and managing a kubernetes cluster to understand better how it works and what is happening under the hood had been realised, as my site had been successfully running on a cluster for a good while with no downtime, including during updates on Kubernetes from 1.15.X to 1.17.X.
As such I decided to look at what I can do to lower the management cost (time) and the hosting cost (money).