kubernetes HA Config Setting
Flannel
[Unit]
Description=Flanneld
Documentation=https://github.com/coreos/flannel
After=network.target
Before=docker.service
[Service]
User=root
ExecStart=/opt/bin/flanneld \
--etcd-endpoints="http://192.168.51.140:2379,http://192.168.51.145:2379" \
--iface=192.168.51.149 \
--ip-masq
Restart=on-failure
Type=notify
LimitNOFILE=65536
here we set
--etcd-endpoints="http://192.168.51.140:2379,http://192.168.51.145:2379"
with multiple endpoint
It works
Kubelet
[Unit]
Description=Kubernetes Kubelet
After=docker.service
Requires=docker.service
[Service]
ExecStart=/opt/bin/kubelet \
--hostname-override=k8stargetnode \
--api-servers="http://192.168.51.139:8080, http://192.168.51.145:8080" \
--register-node=true \
--logtostderr=false \
--log-dir="/var/log/kubernetes" \
--v=6 \
--cluster_dns=172.18.0.5 \
--cluster_domain=cluster.local
Restart=on-failure
KillMode=process
[Install]
WantedBy=multi-user.target
--api-servers="http://192.168.51.139:8080, http://192.168.51.145:8080" \
With error message
E0929 09:44:45.084951 58581 reflector.go:190] k8s.io/kubernetes/pkg/kubelet/config/apiserver.go:46: Failed to list *v1.Pod: Get http://192.168.51.139:8080/api/v1/pods?fieldSelector=spec.nodeName%3Dk8stargetnode&resourceVersion=0: dial tcp 192.168.51.139:8080: getsockopt: no route to host
It Failed, it always get first element.
Kube-proxy
With Error Message
E0929 09:40:44.597567 58456 reflector.go:201] k8s.io/kubernetes/pkg/proxy/config/api.go:49: Failed to list *api.Endpoints: Get http://192.168.51.139:8080,http/192.168.51.145:8080/api/v1/endpoints?resourceVersion=0: dial tcp: unknown port tcp/8080,http
It Failed
Result
An loadbalancer service is need for build k8s(kube-proxy, kubelet) for minion, but flannel can insert multiple address without needing loadbalancer.