Skip to content

Cirrus-8691/Install-PostgreSQL-OnMinikubeOrMicrok8s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to install PostgreSql as Docker image

license:MIT Language:bash

PostgreSql-Logo docker-Logo

In Minikube or Microk8s environment

minikube-Logo kubernetes-Logo

In a single MicroK8s node.

Using bitnami/postgresql helm chart

minikube-Logo helm-Logo

https://github.com/bitnami/charts/tree/main/bitnami/postgresql

Minikube & Microk8s single node cluster

Container hosted in Minikube & Microk8s single node cluster using StorageClass hostpath-storage, when server restart, cannot read/write the previously used PersistentVolume.

We use a StorageClass using kubernetes.io/no-provisioner with reclaimPolicy: Retain, to keep data when the server/laptop where Minikube is running, restart.

As Bitnami chart container run as user 1001 in goup 1001 we have to change default file access mode of the PersistentVolume hostPath.

Customise install according to projet and server ip.

Create your own folder, in networking/values, named with the server ip, like 192.168.0.24.

Copy there this two files and update values for your needs:

  • postgresql.yaml where you can modify database name, user and password, persistence size.
  • pv-postgresql.yaml where you can describe persistant volume specification like hostPath and capacity storage ( same as persistence size below).

Please note: pv-name and pv-hostPath are also present in install.sh for their creation and access rights.

Minikube

#Add bitnami repo only once
sudo helm repo add bitnami https://charts.bitnami.com/bitnami

For install on Minikube run:

cd networking/postgresql-minikube
./install.sh [projectName] [server-ip]
# where 
#  - projectName: is the name of the project for witch PostgreSql is installed
#  - server-ip: is the ip, like 192.168.0.24, who's used by Kubernetes PostgreSql service to share the database with external uses.
#      127.0.0.1 is not a valid server-ip, it will be confused with PostgreSql Docker loopback localhost ip adress.

Warning, if Minikube was started as super user, you have to use sudo.

Sample:

cd networking/postgresql
sudo ./install.sh cirrus-project 192.168.0.24

Uninstall

helm -n [projectName]-postgresql uninstall postgresql
# where 
#  - projectName: is the name of the project for witch PostgreSql is installed

Microk8s:

#Add bitnami repo only once
sudo microk8s helm repo add bitnami https://charts.bitnami.com/bitnami
  • After openning a SSH session to one of the server of the Mick8s cluster,
  • git clonet this project,
  • create a folder named using the current server ip, like "192.168.0.45",
  • customise install according to projet:
    • database
    • username, password
    • persistence.size
  • install Postgresql with:

Microk8s single node cluster

# using "microk8s.io/hostpath"
cd networking/postgresql-microk8s
sudo ./install-1node.sh pv-0 easiware-dev 10.0.0.7
sudo ./install-1node.sh pv-1 easiware-test 10.0.0.7

Microk8s NFS, Ceph-rbd storage class

cd networking/postgresql-microk8s
# using NFS storage class (not recommanded)
sudo ./install-xnodes.sh nfs [projectName]

# using Ceph-rbd storage class
sudo ./install-xnodes.sh ceph [projectName]

Uninstall

sudo microk8s helm -n [projectName]-postgresql uninstall postgresql

About

Install PostgreSQL on Minikube or Microk8s using Bitnami

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages