I have a virtual machine with the following setup:
- a proxy which redirects requests from
localhost:5432
to a postgres server (I can't change this setup) - k3s installed as single-node cluster
How can I access the localhost:5432
service from a pod in k3s?
I have a virtual machine with the following setup:
- a proxy which redirects requests from
localhost:5432
to a postgres server (I can't change this setup) - k3s installed as single-node cluster
How can I access the localhost:5432
service from a pod in k3s?
1 Answer
Reset to default 0I solved by setting
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
in the Pod/Deployment specification. While this approach works, it's not ideal due to potential security risks. However, it's currently the only solution I've found.
localhost
then it must run in the same network namespace (Docker container, Kubernetes Pod) as the database, and that might mean you can't run the proxy in a container in this setup. – David Maze Commented Feb 4 at 15:32