I've setup a kubernetes cluster using kubespray, and now I am trying to follow this guide
root@node1 ~ # kubectl get -n heptio-contour service contour -o wide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
contour LoadBalancer 10.233.55.94 <pending> 80:32414/TCP,443:30149/TCP 42m app=contour
It seems EXTERNAL-IP
is pending because I am on a bare metal machine (not AWS/GKE etc.)
What do I need to do in order to get an external ip showing there?
Kubernetes offers three ways to expose a service:
1) L4 LoadBalancer: Available only on cloud providers such as GCE and AWS
2) Expose Service via NodePort: The NodePort directive allocates a port on every worker node, which proxy the traffic to the respective Pod.
3) L7 Ingress: The Ingress is a dedicated load balancer (eg. nginx, HAProxy, traefik, vulcand) that redirects incoming HTTP/HTTPS traffic to the respective endpoints
Kubernetes does not offer implementation of network load-balancers (Services of type LoadBalancer) for bare metal clusters.
If you’re not running Kubernetes cluster on a supported IaaS platform (GCP, AWS, Azure…), LoadBalancers will remain in the “pending” state regardless of the time they were created.
The reason is the lack of support of IP routing between the external world and Kubernetes; there is no default implementation of transferring dns zones used by Ingress to allocate communication to internal of the cluster.
There are external projects to provide bare-metal even in federation clusters mode to be part of standalone or hybrid solution.
It depends on the scale and the maturity of projects you have, so it should begin with choosing a proper load balancer or VIP provider:
https://github.com/google/metallb
https://docs.traefik.io/
https://github.com/kubernetes/contrib/tree/master/keepalived-vip
http://vulcand.github.io/
and deprecated:
http://www.linuxvirtualserver.org/software/ipvs.html
Please notice that in federation clusters (more than one bare metal Kubernetes cluster) is needed to export IP address of each physical machine to central API provider and probably it is not covered by the links I provided to you.