How to access non-k8s service running on node from inside k8s pod?

Let’s say I have single node k3s and I have a non-Kubernetes service running on my node at port 8080 for example.

Something like this:

Does it possible for my Kubernetes pod to communicate or access that service? What’s needed to make it happen?

Hi zulh:

If your node’s IP is 1.2.3.4, any of your pods can access the endpoint as http://1.2.3.4:8080 (using http for simplicity, but If I guess any protocol will work).

Your pods /etc/resolv.conf file is the same as the node /etc/resolv.conf, so if your node’s hostname is mynode.mydomain.lab, and in some DNS mydns.mydomain.lab points to your node’s IP (1.2.3.4), your pods should be able to contact your service also by using http://mynode.mydomain.lab:8080.

Best regards,

Xavi

Thanks @xavi. I’ll give it a try.