Kubernetes Networking connect local/container

4/18/2017

I'm a Developer going up the learning curve to become more DevOps.

I'm building a Kubernetes cluster. I'd like to be able to 'directly' connect to pods. I don't want to be load balanced through a Service, I want to be able to connect to individual pods.

I'm reading up about networking, but feel overwhelmed. I'll get the answer myself when I've grokked the details, but before then is there any expert that can answer:

Is there any kubernetes networking option that will allow me to talk TCP/IP from my local directly to individual pods?

I am absolutely open to running something locally to achieve this. I don't really care if its overlay or not (no latency requirements). I'm thinking I can run Calico on the Cluster, Bird on my Machine. Is this true? Has anyone done anything similar?

-- losty
calico
flannel
kubernetes
networking

1 Answer

4/18/2017

There are a couple of options for this.

If you want to connect to one particular pod you can simply kubectl port-forward which will forward local port to pods port.

If you need full network connectivity, depending on how you provisioned the cluster, you can actually make your pc a part of the same overlay network as your kubernetes cluster (I do something like that using weave net).

All in all, apart of the port-forward solution, it's more of a generic networking issue rather than kubernetes in particular. But then again, if you manage to become peer in your overlay, you still have the issu of service discovery to crack, if you dont want to use services...

-- Radek 'Goblin' Pieczonka
Source: StackOverflow