I have a REST API running locally on my laptop at https://localhost:5001/something
. I want that to be reachable inside the Kubernetes cluster from a K8s DNS name. For example, an application running inside a Pod could use some-service
instead of needing the entire Url.
Also, since localhost
is relative to the host machine, how would I get the Service
or ExternalName
to reach localhost
on the host machine, instead of inside the K8s cluster?
I tried docker.host.internal
(as suggested here) but that didn't work.
And this from K8s documentation says that it can't be the loopback:
The endpoint IPs must not be: loopback (127.0.0.0/8 for IPv4, ::1/128 for IPv6), or link-local (169.254.0.0/16 and 224.0.0.0/24 for IPv4, fe80::/64 for IPv6).
I'm running:
- Host Machine: Ubuntu 20.04
- K8s: k3d
- Web API: (.Net Core 3.1 on Linux, created by
dotnet new webapi MyAPI
)