How to expose kubernetes service to public without hardcoding to minion IP?

前端 未结 5 886
傲寒
傲寒 2020-12-24 13:12

I have a kubernetes cluster running with 2 minions. Currently I make my service accessible in 2 steps:

  1. Start replication controller & pod
  2. Get mini
5条回答
  •  鱼传尺愫
    2020-12-24 13:53

    As I mentioned in the comment above, the createExternalLoadBalancer is the appropriate abstraction that you are looking for, but unfortunately it isn't yet implemented for all cloud providers, and in particular for vagrant, which you are using locally.

    One option would be to use the public IPs for all minions in your cluster for all of the services you want to be externalized. The traffic destined for the service will end up on one of the minions, where it will be intercepted by the kube-proxy process and redirected to a pod that matches the label selector for the service. This could result in an extra hop across the network (if you land on a node that doesn't have the pod running locally) but for applications that aren't extremely sensitive to network latency this will probably not be noticeable.

提交回复
热议问题