ernest
ernest

Reputation: 71

Forward TCP connections through docker container

I have springboot microservice running inside docker container (Kubernetes) which can access unmanaged services (SQL, Elasticsearch, etc), which are not accessible from my laptop directly, so I'm forced to run commands via kubectl to access them. Is there a posibility to forward TCP connections through docker containers to enable direct access to those service, something like ssh port forwarding?

Upvotes: 0

Views: 285

Answers (2)

titou10
titou10

Reputation: 2977

For this you have to create a"service without selector"and defineendpointsfor your "external" resources

Kubernetes doc on such services here

Of course, your service can be of type"NodePort", so with the help of your load balancer in front of OCP, you can access the service from outside your cluster and the service will reach your external resource

Upvotes: 3

JJ Asghar
JJ Asghar

Reputation: 609

Yep, you can use kubectl port-forward to do exactly this. If you'd like to read the documentation it's here.

Upvotes: 0

Related Questions