K8S-Demo集群实践07:kube-apiserver高可用方案
- 3个master节点部署了apiserver+controller-manager+scheduler
- kube-controller-manager、kube-scheduler是连接本机的kube-apiserver,可以把它们看做一个整体,只要有一个节点的apiserver实例正常,就可以保证集群apiserver可用
- 在每个节点部署一个nginx进程,后端对接3个Master节点的apiserver实例,nginx对它们做健康检查和负载均衡,即高可用
- kubelet、kube-proxy通过本地的nginx(监听 127.0.0.1)访问kube-apiserver
一、下载和编译Nginx
[root@master1 ~]
[root@master1 install]
[root@master1 install]
[root@master1 install]
[root@master1 install]
[root@master1 nginx-1.18.0]
[root@master1 nginx-1.18.0]
[root@master1 nginx-1.18.0]
[root@master1 nginx-1.18.0]
nginx version: nginx/1.18.0
[root@master1 nginx-1.18.0]
nginx version: nginx/1.18.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --with-stream --with-stream_ssl_preread_module --with-stream_ssl_module --without-http--prefix=/opt/soft/nginx-1.18.0/nginx-prefix --without-http_uwsgi_module --without-http_scgi_module --without-http_fastcgi_module
- –with-stream:开启四层透明转发(TCP Proxy)功能
- –with-stream_ssl_preread_module
- –with-stream_ssl_module
- –without-http:关闭HTTP代理
二、安装和部署nginx
1、nginx配置