How to access a Postgres availale through a Kubernetes cluster from your local machine
Create a socat pod on your default namespace (or whatever namespace you see fit) This pod will then create a bytestream to the postgres' instance and port -> set postgresql-host accordingly
apiVersion: v1
kind: Pod
metadata:
name: postgresql-socat
labels:
name: postgresql-socat
spec:
containers:
- name: postgresql-socat
image: alpine/socat
command: ["socat", "-dd", "tcp4-listen:5432,fork,reuseaddr", "tcp4:postgresql-host:5432"]
resources:
limits:
memory: "64Mi"
cpu: "50m"
ports:
- containerPort: 5432
Then forward the pod's container...
`kubectl port-forward postgresql-socat 5432:5432`
... and open up a connection to your upstream's postgres connection
`psql -h localhost -p 5432 ...`