Mapping an external http load balancer to a Kubernetes Cluster

4/12/2016

I've created my first Kubernetes cluster on Google Cloud

gcloud config set compute/zone europe-west1-c
gcloud config set compute/region europe-west1
gcloud container clusters create ___-cluster --num-nodes 1 --machine-type n1-standard-1

Started multiple pods:

kubectl run ___-wui --image=eu.gcr.io/____________/___-wui:latest --port=80
kubectl run rabbitmq --image=eu.gcr.io/____________/rabbitmq:latest --port=15672

Using kubectl get pods I can see that two pods are running

NAME             READY     STATUS    RESTARTS   AGE
___-wui-ihggr    1/1       Running   0          1h
rabbitmq-fzt4q   1/1       Running   0          4m

Now I expose these two pods:

kubectl expose rc ___-wui --type="LoadBalancer"
kubectl expose rc rabbitmq --type="LoadBalancer"

Using kubectl cluster-info I can see the dashboard url and I can access both applications from there.

Looking at the Network Load Balancing section, I can see my two apps there each with their own IP addresses.

What I want to do now is map these urls on my domain to these apps, for example both on port 80:

http://example.com/rabbitmq -> rabbitmqapp
http://example.com/___-wui -> wui-app 

How would I go about achieving this? My only experience is with mapping urls to instance groups which I don't see in Kubernetes.

-- Jan Vladimir Mostert
google-cloud-platform
kubernetes

1 Answer

4/13/2016

You do this by creating an Ingress http://kubernetes.io/docs/user-guide/ingress/. There should already be a l7 controller running in kube-system.

Some common caveats that trip users are:
1. Quota
2. Firewall rules
3. Health checks

These are documented here: https://github.com/kubernetes/contrib/blob/master/ingress/controllers/gce/BETA_LIMITATIONS.md

You can also turn down the GCE ingress controller and deploy an nginx contorller if you just want to get familiar with the Ingress resource without using your GCE quota.

-- Prashanth B
Source: StackOverflow