K8s porforward to external resource through pod

2/13/2022

I have K8s cluster in Azure, and have some configured cognitive services in Azure. These services have disabled public access but open for internal private network (private endpoints).

So, these resource are available from K8s cluster (I am able to access (telnet/curl) to them) but unavailable from my local machine.

Is it possible to execute portforwarding to Azure resources through pod? For example - access to 5432 psql service or 443 for some cognitive services?

I had tried something like this:

kubectl port-forward --address localhost -n XXX pod/XXX 8083:443

and tried to send request to localhost:8083 but unsuccessfully

-- prosto.vint
azure
azure-cognitive-services
kubernetes
portforwarding

1 Answer

2/21/2022

Thank you Tamer Elfeky and prosto.vint posting your discussions into answer section to help other community members.

Port forwarding works just as Port Natting not as Router. To access the remote services, Proxies are required.

-- MadhurajVadde-MT
Source: StackOverflow