4

I'm currently playing with kubernetes. I started it according to the documentation locally using the vagrant approach. Everything works fine but I can't manage to expose a service port, e.g. the web frontend of a container. In the documentation it's only described for google cloud, where google seems to be configured automatically to expose a port on it's loadbalancer. But how can I configure a port on a local installation?

peez80
  • 171
  • 5

1 Answers1

3

Assuming you know how to redirect ports on vagrant without Kubernetes (https://docs.vagrantup.com/v2/networking/forwarded_ports.html), There are many ways to reach Services in Kubernetes:

  1. Deploy a bare metal service loadbalancer (https://github.com/kubernetes/contrib/tree/master/service-loadbalancer) or ingress controller + create Ingress (this reaquires Kubernetes 1.1 https://github.com/kubernetes/contrib/tree/master/service-loadbalancer)

  2. Use service.type=nodeport (https://github.com/kubernetes/kubernetes/blob/release-1.0/docs/user-guide/services.md#type-nodeport)

  3. In the same vein, use proxy-to-service (https://github.com/kubernetes/contrib/tree/master/for-demos/proxy-to-service)

  4. Use hostPort for your RC/Pod (against best practice: https://github.com/kubernetes/kubernetes/blob/release-1.0/docs/user-guide/config-best-practices.md)

beeps
  • 951
  • 6
  • 2