An HAProxy for load balancing Kubernetes endpoints.
4.3K
An HAProxy for load balancing Kubernetes endpoints. Particularly useful for running Kubernetes on Mesos/Mesosphere DCOS. This is because in a Kubernetes cluster the endpoint ports and IP addresses may change for a service.
This proxy will monitor the endpoint for changes in etcd and update HAProxy with the new endpoints.
Given the following service in Kubernetes, we will run the proxy container with the options below.
{
"id": "pandora-nginx",
"kind": "Service",
"apiVersion": "v1beta1",
"port": 80,
"containerPort": 80,
"selector": {
"name": "pandora-nginx"
},
"labels": { "name": "pandora-nginx" }
}
docker run -e "ETCD_HOST=leader.mesos" \
-e "ETCD_PORT=4001" \
-e "KUBERNETES_ENDPOINT=pandora-nginx" \
-e "HAPROXY_HEALTH_CHECK_PATH=/robots.txt" \
-p 80:80 \
zymlabs/kubernetes-endpoint-proxy
Requests should then be routed through the proxy to the endpoint.
docker pull zymlabs/kubernetes-endpoint-proxy:latest