How to connect from a kubernetes cluster to local PostgreSQL database? - kubernetes

How can I connect from an application that runs inside a pod in a Kubernetes cluster (minikube) to a local database (installed locally, not running in docker)?

Related

kubernetes pod not able to connect to database in same network

I've setup a kubernetes cluster in my network and a postgres database in same network. I am able to connect my java app to my postgres database if I run it over in a container or a VM. But some how when I deploy the same app in Kubernetes it is not able to connect to my database.
All my services are in my private network and my cluster is a bare metal setup in my home lab using calico network.
I also tried ping my database ip from a busybox pod but that also fails.

How to connect to the remote mongodb pod running in a kubernetes cluster without its IP using mongo client

I got several replicas of mongodb pods into my cluster. And got a bastion server through which I can connect to each mongodb pod running in a private subnet. I can do that by mongodb pod IP into the connection string.
mongodb://username:password#xx.xxx.xxx.112:27017/
But I want to connect to the database using a pod name / service name instead of a dynamic pod IP which gets changed every time I recreate the pod. Using the pod default DNS with service name doesn't work in this case ( e.g. mongodb-0.mongo.default.svc.cluster.local)
Any idea how to connect to the mongodb pods using mongo client without using their IPs?

Why deployment with istio sidecar having connectivity issues outside cluster running on openshift?

I am having a deployment with istio-proxy sidecar running in an openshift cluster.
Its connects to a mysql database in an external VM outside cluster.
When I am not using the sidecar it connects the DB in the first try.
Whereas it cannot connect to the DB when the deployment running with istio-sidecar in the first go.
It connects to the DB after 2-3 retries and resulting in POD restarts 2-3 times.
Where i may go wrong.If i may get any help or insight.

Unable to connect to atlas MongoDB

I'm running a soringboot application in minikube. But it's not able to connect to MongoDB cluster which is on atlas. Can someone help me with this issue? I'm able to connect from my local but not from minikube pod. I've minikube cluster with docker driver

Port forward from kubernetes pod to local container

I need to connect a service running in a local container inside Docker on my machine to a database that's running on a Kubernetes cluster.
Everything I found on port forwarding allowed me to connect my machine to the cluster, but not the local container to the cluster (unless I install kubectl on my container, which I cannot do).
Is there a way to do this?
https://www.telepresence.io/ is what you're looking for. It will hook into the cluster network like a VPN and patch the services so traffic will get routed through the tunnel.