Loadblance across kubernetes master nodes

7/30/2019

Is there any documentation how to use an external load balancer to load balance traffic on kubernetes API server.

Use case:

I don't prefer to use single master node ip/name in kubeconfig file and need a common name for all of the masters so that if one master is down , it sends traffic to other.

I have DNS name already pinting to loadbalancer ip , and loadbalancer is confifured with SSL certificate and kubernetes master backend nodes , but it results in an error: "plan http request was sent to https server "

Somehow the load balancer is sending http request to kubernetes API server instead of https.

-- Ijaz Ahmad Khan
kubernetes
pulsesecure

1 Answer

8/4/2019

Turns out that it doenst work on L7 http , but works fine on L4 tcp.

The HAProxy configuration looks like:

frontend k8s-api
  bind 192.168.0.150:443
  bind 127.0.0.1:443
  mode tcp
  option tcplog
  default_backend k8s-api

backend k8s-api
  mode tcp
  option tcplog
  option tcp-check
  balance roundrobin
  default-server inter 10s downinter 5s rise 2 fall 2 slowstart 60s maxconn 250 maxqueue 256 weight 100
  server k8s-api-1 192.168.0.147:6443 check
  server k8s-api-2 192.168.0.148:6443 check
  server k8s-api-3 192.168.0.149:6443 check
-- Ijaz Ahmad Khan
Source: StackOverflow