[英]Is Kubernetes high availability using kubeadm possible without failover/load balancer?
I am trying to achieve the k8s high availability using kubeadm. 我正在尝试使用kubeadm实现k8s的高可用性。 I am following the document k8s HA using kubeadm
我正在使用kubeadm关注文档k8s HA
In the official document, it is recommended to have the failover mechanism/load balancer for the kube-apiserver. 在官方文档中,建议为kube-apiserver安装故障转移机制/负载平衡器。 I tried keepalived but, in case of setup on aws/gcp instaces, it lands in split brain situation as multicast is not supported and so I am not allowed to use it.
我尝试了keepalived,但是如果在aws / gcp instaces上进行安装,由于不支持多播,因此它会陷入裂脑状态,因此我不允许使用它。 Is there any way out for this?
有什么办法吗?
No, you need a loadbalancer to have HA with kubeadm. 不,您需要一个负载平衡器才能使kubeadm具有HA。
If you're using AWS/GCP, why not consider using the native loadbalancers for those environments, like ELB or a Google Cloud Load Balancer? 如果您使用的是AWS / GCP,为什么不考虑在这些环境(例如ELB或Google Cloud Load Balancer)中使用本机负载平衡器?
Kubernetes is a container-orchestration system for automating deployment, scaling, and management of containerized applications. Kubernetes是一个容器编排系统,用于自动化容器化应用程序的部署,扩展和管理。 Kubernetes play best in High Available and Load Balancing environments.
Kubernetes在高可用性和负载平衡环境中发挥最佳作用。
As @jaxxstorm mentioned, cloud providers give you a possibility to use native load balancers, and I also suggest it is a good pole position with High Availability attempt. 正如@jaxxstorm所提到的,云提供商为您提供了使用本机负载平衡器的可能性,并且我还建议尝试进行高可用性是一个很好的选择。 You may be interested in GCP documentation.
您可能对GCP文档感兴趣。
Kubeadm on Kubernetes homebrewed environment requires some additional work, and from my point of view, it is good to set up Kubernetes The Hardway then starts to play with Kubeadm . 在Kubernetes自制环境上的Kubeadm需要做一些额外的工作,从我的角度来看,设置Kubernetes是一件好事。Hardway随后开始与Kubeadm一起玩。
OK, I assume servers for the installation are ready. 好的,我假设安装服务器已经准备就绪。 To create a not complex installation of multi-master cluster, you need 3 masters node (10.0.0.50-52) and Load Balancer (10.0.0.200) .
要创建不复杂的多主群集安装, 您需要3个主节点(10.0.0.50-52)和负载均衡器(10.0.0.200) 。
Generate token and save the output to file: 生成令牌并将输出保存到文件:
kubeadm token generate
Create a kubeadm config file: 创建一个kubeadm配置文件:
apiVersion: kubeadm.k8s.io/v1alpha1
kind: MasterConfiguration
etcd:
endpoints:
- "http://10.0.0.50:2379"
- "http://10.0.0.51:2379"
- "http://10.0.0.52:2379"
apiServerExtraArgs:
apiserver-count: "3"
apiServerCertSANs:
- "10.0.0.50"
- "10.0.0.51"
- "10.0.0.52"
- "10.0.0.200"
- "127.0.0.1"
token: "YOUR KUBEADM TOKEN"
tokenTTL: "0"
Copy the config file to all nodes. 将配置文件复制到所有节点。
Do initialization on the first master instance: 在第一个主实例上执行初始化:
kubeadm init --config /path/to/config.yaml
The new master instance, will have all the certificates and keys necessary for our master cluster. 新的主实例将具有我们的主集群所需的所有证书和密钥。
Copy directory structure /etc/kubernetes/pki
to other masters to the same location. 将目录结构
/etc/kubernetes/pki
复制到其他主目录到同一位置。
On other master servers: 在其他主服务器上:
kubeadm init --config /path/to/config.yaml
Now let's start to set up load balancer: 现在让我们开始设置负载均衡器:
Copy /etc/kubernetes/admin.conf
into $HOME/.kube/config
将
/etc/kubernetes/admin.conf
复制到$HOME/.kube/config
next, edit $HOME/.config
and replace 接下来,编辑
$HOME/.config
并替换
server:10.0.0.50
服务器:10.0.0.50
with 与
server:10.0.0.200
服务器:10.0.0.200
Check if nodes are working fine: 检查节点是否工作正常:
kubectl get nodes
On all workers execute: 对所有工人执行:
kubeadm join --token YOUR_CLUSTER_TOKEN 10.0.0.200:6443 --discovery-token-ca-cert-hash sha256:89870e4215b92262c5093b3f4f6d57be8580c3442ed6c8b00b0b30822c41e5b3
And that's it! 就是这样! If everything was setup cleanly, you should now have a highly available cluster.
如果一切设置都干净整洁,那么您现在应该拥有一个高度可用的集群。
I found "HA Kubernetes cluster via Kubeadm" tutorial useful, thank you @Nate Baker for inspiration. 我发现“通过Kubeadm的HA Kubernetes集群”教程很有用,谢谢@Nate Baker的启发。
您绝对需要nginx / haproxy + keepalived来实现故障转移和高可用性
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.