I am using Docker for Windows (docker-desktop) which ships with a small single node kubernetes instance. I have a scenario where my pods needs to communicate with some external services running on the same localhost(windwos 10 machine), but outside of the k8s cluster.
I know that I can use
kubernetes.docker.internal from within the cluster to reach my
node/localhost . But unfortunately the pods has some default connection string within the image which I don’t want to change - say the pods are by default trying to connect to a dns string - “my-server”. So in my scenario, I want to define a K8s service with name “my-server” which has an Endpoint reference to kubernetes.docker.internal so that the kube-proxy will route that correctly to my localhost which is my windows 10 machine.
Is this somehow possible? I have already checked this solution, but it talks about external services running on some other node or cloud. I am also considering the local machine hostname as an ExternalName, but this is not entirely reliable in dns resolution for my usecase. So I really want to use the
kubernetes.docker.internal as a service endpoint. Any thoughts?