Skip to content

Latest commit

 

History

History
74 lines (54 loc) · 1.63 KB

File metadata and controls

74 lines (54 loc) · 1.63 KB

Setting up the cluster

Install virtualbox (needed for minikube) https://www.virtualbox.org/wiki/Downloads

Install minikube https://minikube.sigs.k8s.io/docs/start/

minikube start --kubernetes-version=v1.27.0
minikube addons enable metrics-server
minikube dashboard

# If need to start over you can
minikube delete
# and try the above commands again

Install kubectl cli https://kubernetes.io/docs/tasks/tools/

kubectl version --short

Install psql client https://www.postgresql.org/download/

psql --version

Setting up PGO

PGO Quick Start https://access.crunchydata.com/documentation/postgres-operator/latest/quickstart/

cd postgres-operator-examples
kubectl apply -k kustomize/install/namespace
kubectl apply --server-side -k kustomize/install/default
kubectl -n postgres-operator get pods

Change the default namespace

kubectl config set-context --current --namespace=postgres-operator

Connect to the database

# Expose the 6432 port
PG_CLUSTER_PRIMARY_POD=$(kubectl get pod -n postgres-operator -o name \
  -l postgres-operator.crunchydata.com/cluster=hippo,postgres-operator.crunchydata.com/role=master)
kubectl -n postgres-operator port-forward "${PG_CLUSTER_PRIMARY_POD}" 6432:5432

# Get the connection string
kubectl -n postgres-operator get secrets hippo-pguser-hippo -o go-template='{{.data.uri | base64decode}}'

# Connect using psql. Change the host to `localhost` and port to `6432`
psql postgresql://hippo:ClW0%7B3%28%3Ff.%7DUuT4%28GXnJW0cz@localhost:6432/hippo

Check some SQL commands

-- look at all relations
\d
-- look at all available extensions
\dx