-
Notifications
You must be signed in to change notification settings - Fork 2
Step 3.2 Installing Postgres Database.
GowthamCh edited this page May 5, 2022
·
7 revisions
A working Kubernetes cluster.
Ref: Link
- Login to the master machine.
- Install Helm. Ref:Link. You can run the below commands to install Helm.
curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -
sudo apt-get install apt-transport-https --yes
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm
- Copy the files from this directory to your master machine. (You can clone the repo and cd to this directory)
- Change the storage parameter in the pv.yaml, pv1.yaml, pv2.yaml files from "storage: 28Gi" to "storage: 10Gi".
- Run the below commands to create Persistent volumes at the mount point.
kubectl apply -f pv.yaml
kubectl apply -f pv1.yaml
kubectl apply -f pv2.yaml
- In the postgresql-values.yaml file update the username and password (Line 138 and Line 143). It can be anything you want.
kubectl create namespace keycloak
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install keycloak-db-postgresql bitnami/postgresql -f postgresql-values.yaml -n keycloak --version 10.12.3
- Testing the database is up or not.
To get the password for "postgres" run:
export POSTGRES_ADMIN_PASSWORD=$(kubectl get secret --namespace keycloak keycloak-db-postgresql -o jsonpath="{.data.postgresql-postgres-password}" | base64 --decode)
To get the password for "<user name you provided>" run:
export POSTGRES_PASSWORD=$(kubectl get secret --namespace keycloak keycloak-db-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)
To connect to your database run the following command, please replace your user name appropriately
kubectl run keycloak-db-postgresql-client --rm --tty -i --restart='Never' --namespace keycloak --image docker.io/bitnami/postgresql:11.11.0-debian-10-r50 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host keycloak-db-postgresql -U GIVEYOURUSERNAMEHERE -d postgresDB -p 5432
You should be able to login to the postgres shell when you run the last command. Also check the logs of the pods to make sure that there are no error messages.
- If you faced any issue while setting up postgres and want to start from step-3 (above).
- Make sure you delete the persistent volumes properly.
- Uninstall the postgres application via helm chart.
- Delete the 'keycloak' namespace.
Milestone - 1:
Milestone - 2:
- Weather service and Forecasting service with 1 pod
- Weather Service and Forecasting Service with 3 and 5 pods
- User service - 1 pod
- User service -3 and 5 pods
- Auto Scaling
Milestone -3:
Milestone - 4: