zoukankan      html  css  js  c++  java
  • [经验交流] Active-Active 方式设置 kubernetes master 多节点高可用

    关于 kubernetes master 多节点以及高可用,网上的方法多采取 Active-Standby 方式,即:

    通过 pacemaker 等软件使得某种 master 服务(apiserver,scheduler,controller-manager)同一时间只运行一个实例。具体来说,如果有多台master node,上面都安装了scheduler,controller-manager, apiserver:

    • 对于schduler服务,同一时间只在一台master 节点上运行,
    • 对于controller-manager,同一时间只在一台master 节点上运行,
    • 对于apiserver,同一时间只在一台master 节点上运行,

    这种方法的可靠性有待探讨,至少我出现过这样的问题:一旦因pacemaker出现问题或者管理员误操作,在多个节点上同时启动了scheduler或者controller-manager,就会造成系统故障。

    实际上,参考kubernetes最新文档,官方有相关的提示:

    Master elected components

    So far we have set up state storage, and we have set up the API server, but we haven’t run anything that actually modifies cluster state, such as the controller manager and scheduler. To achieve this reliably, we only want to have one actor modifying state at a time, but we want replicated instances of these actors, in case a machine dies. To achieve this, we are going to use a lease-lock in the API to perform master election. We will use the --leader-elect flag for each scheduler and controller-manager, using a lease in the API will ensure that only 1 instance of the scheduler and controller-manager are running at once. 

    也就是说,controller-manager和scheduler 只要加上 --leader-elect=true 参数就可以同时启动,系统会自动选举leader。而apiserver本来就可以多节点同时运行,只要它们连接同一个etcd cluster 就可以了。

    按照上面的思路,master ha 架构可以如下设计:

    注:

    1. 首先设置etcd cluster

      关于etcd的cluster设置方法,网上有成熟的文档可以参考;

    2. 各个master 节点的apiserver同时启动,指向相同的 etcd cluster 

    3. apiserver 服务设置 VIP

      建议通过keepalived+lvs 或者 haproxy设置,支持负载均衡;

    4. 各个master 节点的controller-manager 和 scheduler 加 --leader-elect=true 参数同时启动

    经过上面的设置,所有master节点上的相关服务都是 Active 状态,如果有一个节点或者一个服务挂掉都不影响整个集群的运行。

  • 相关阅读:
    【瞎搞】 HDU 3101 The Heart of the Country
    使用EXCEL设置“下拉菜单”选项功能
    IE, FireFox, Opera 浏览器支持CSS实现Alpha透明的方法 兼容问题
    Linux的文件权限
    刘德华夏日Fiesta演唱会上那个表演探戈舞的演员是谁啊?_百度知道
    每周日与周四《红酒屋》探戈舞会"Wine Bar" Milonga_原生态拉丁_新浪博客
    精华区文章阅读
    探戈
    探戈
    TangoWalk小组课程与优惠(20131208更新) | TangoWalk 学跳阿根廷探戈舞
  • 原文地址:https://www.cnblogs.com/hahp/p/5803694.html
Copyright © 2011-2022 走看看