How can container (running on the local host) access services running on remote hosts, which are port forwarded to the local host

8/15/2021

Here's a scenario:

  • Host (local computer running macOS) has access to the number of services running on various IPs within the 127.1.1.0/24 network range.
  • That network is not a real local network, but instead done through kubectl port-forward (and maybe some other magic xD). That basically gives host access to the services running in the remote K8s cluster namespace. For context, that is achieved through Bridge to Kubernetes VSCode extension.
  • Host can ping or curl any of those services via their respective IPs and ports on the 127.1.1.0/24 network. E.g. curl 127.1.1.15:9098

How to make a service running inside the docker container on the host (local machine) be able to send network requests to any of those port-forwarded remote services with 127.1.1.0/24 IPs?

Any potential solutions appreciated. Thanks.

-- nicktgn
docker
kubectl
kubernetes

0 Answers