操作系统信息
6 台虚拟机,系统centos 7.5.
kubesphere 3.0
Kubernetes v17.9
IP 地址 主机名 角色
192.168.1.251 lb1 Keepalived & HAproxy
192.168.1.146 lb2 Keepalived & HAproxy
192.168.1.170 master1 master
192.168.1.148 master2 master
192.168.1.147 master3 master
192.168.1.168 worker1 worker
集群状态

[root@w-k-m ~]# telnet lb.kubesphere.local 6443
Trying 192.168.1.25…
Connected to lb.kubesphere.local.
Escape character is ‘^]’.
ZConnection closed by foreign host.

Keepalived & HAproxy 都正常,虚拟ip和6443的转发已启动。


关闭192.168.1.170 后,集群就无法使用.
[root@k-m-147 ~]# kubectl get nodes -A
Unable to connect to the server: EOF

    haerror haproxy 配置
    cat /etc/haproxy/haproxy.cfg
    global
    log /dev/log local0 warning
    chroot /var/lib/haproxy
    pidfile /var/run/haproxy.pid
    maxconn 4000
    user haproxy
    group haproxy
    daemon


    stats socket /var/lib/haproxy/stats


    defaults
    log global
    option httplog
    option dontlognull
    timeout connect 5000
    timeout client 50000
    timeout server 50000


    frontend kube-apiserver
    bind *:6443
    mode tcp
    option tcplog
    default_backend kube-apiserver

    frontend kube-console
    bind *:30880
    mode tcp
    option tcplog
    default_backend kube-console

    backend kube-apiserver
    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 kube-apiserver-1 172.16.0.4:6443 check # Replace the IP address with your own.

    server kube-apiserver-2 172.16.0.5:6443 check # Replace the IP address with your own.

    server kube-apiserver-3 172.16.0.6:6443 check # Replace the IP address with your own.

    server kube-apiserver-1 192.168.1.170:6443 check on-marked-down shutdown-sessions# Replace the IP address with your own.
    server kube-apiserver-2 192.168.1.148:6443 check on-marked-down shutdown-sessions# Replace the IP address with your own.
    server kube-apiserver-3 192.168.1.147:6443 check on-marked-down shutdown-sessions# Replace the IP address with your own.

    backend kube-console
    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 kube-apiserver-1 172.16.0.4:6443 check # Replace the IP address with your own.

    server kube-apiserver-2 172.16.0.5:6443 check # Replace the IP address with your own.

    server kube-apiserver-3 172.16.0.6:6443 check # Replace the IP address with your own.

    server kube-console-1 192.168.1.170:30880 check on-marked-down shutdown-sessions# Replace the IP address with your own.
    server kube-console-2 192.168.1.148:30880 check on-marked-down shutdown-sessions# Replace the IP address with your own.
    server kube-console-3 192.168.1.147:30880 check on-marked-down shutdown-sessions# Replace the IP address with your own.

      2 年 后

      遇到了同样的问题,楼主解决了吗 😀