Kubernetes 单点故障和负载均衡
Kubernetes single point of failure and load balancing
我对 Kubernetes 的基本查询很少。
考虑以下部署。第 7 层负载均衡器将通过 Kubernetes 服务将请求路由到 NGINX 服务器,而 NGINX 将路由到 Tomcat,Kubernetes 服务。
查询:
如果Kubernetes服务单点故障或者因为它被多个pods支持,上面配置了kube-proxy,services只是一个虚拟层,不能认为是单点故障?
上图是单个 Kubernetes 集群,这是单点故障还是我应该为需要支持 HA 且零停机时间的系统规划多个 Kubernetes 集群。
上图利用了默认情况下仅支持 L4 负载平衡(仅循环法)的 Kubernetes 服务。因此,假设 tomcat 服务器负载很重,循环法不会根据使用情况平均分配负载。如何根据系统资源消耗或使用情况或否实现负载分配。上述拓扑中打开的连接数?
注:没有。上图中的矩形框仅供参考。我将每层部署 10 到 20 个 pods 来满足我的工作量。
- If Kubernetes service a single point of failure or because it is supported by multiple pods on which kube-proxy is configured and services is just a virtual layer, it cannot be considered as single point of failure?
我认为你后一种解释是正确的。
- Above diagram is a single Kubernetes cluster, is this a single point of failure or should I plan for multiple Kubernetes cluster for system where I need to support HA with zero downtime.
k8s集群没有HA,因为master节点是单点故障。主节点上的重要组件包括 apiserver 和控制器管理器,没有它们你无法创建更多 pods 或服务。也就是说,即使主节点关闭,您部署的服务也应该继续工作。
有一个关于如何在 HA 模式下设置 k8s 集群的指南,虽然我没有亲自尝试过:http://kubernetes.io/docs/admin/high-availability/. Also there is Ubernetes (WIP),它允许您跨云提供商联合多个 k8s 集群。
- Above diagram leverages Kubernetes services which by default supports only L4 Load balancing (round robin only).
这不是真的,kubernetes 有 beta 功能叫做 ingress,它支持 L7 负载平衡,看看它是否有帮助 http://kubernetes.io/docs/user-guide/ingress/ :)
以下 Kubernetes 的 50+ pods(计划在不久的将来扩展到 250+)内部部署成功上线是我和我的团队收集的经验观察:
- If Kubernetes service a single point of failure or because it is
supported by multiple pods on which kube-proxy is configured and
services is just a virtual layer, it cannot be considered as single
point of failure?
如果负载平衡器 (LB) 映射到单个节点 IP,则将是单点故障,因为该 VM/物理服务器的故障将导致整个应用程序崩溃。因此,将 LB 指向至少 2 个不同的节点 IP。
- Above diagram is a single Kubernetes cluster, is this a single point
of failure or should I plan for multiple Kubernetes cluster for system
where I need to support HA with zero downtime.
使用负载均衡器在 HA 中配置 Kubernetes
- Above diagram leverages Kubernetes services which by default supports only L4 Load balancing (round robin only). Hence say a tomcat
server is heavily loaded, round robin will not distribute load evenly
based on usage. How to achieve load distribution based upon system
resource consumption or usage or no. of open connections in the above
topology?
是的,目前仅支持循环负载平衡。 Ingress 处于测试阶段,在我上次检查时尚未准备好投入生产。
NGINX+ 可用于负载平衡,忽略 Kubernetes 负载平衡并使用 Kubernetes API,它可以配置为添加或删除 Tomcat Pods 在运行时在 NGINX+ 中更新,无需任何停机时间。 (我还没有尝试过,但如果当前设置引发任何挑战,将来可能会考虑)
参考:https://www.nginx.com/blog/load-balancing-kubernetes-services-nginx-plus/
我对 Kubernetes 的基本查询很少。
考虑以下部署。第 7 层负载均衡器将通过 Kubernetes 服务将请求路由到 NGINX 服务器,而 NGINX 将路由到 Tomcat,Kubernetes 服务。
查询:
如果Kubernetes服务单点故障或者因为它被多个pods支持,上面配置了kube-proxy,services只是一个虚拟层,不能认为是单点故障?
上图是单个 Kubernetes 集群,这是单点故障还是我应该为需要支持 HA 且零停机时间的系统规划多个 Kubernetes 集群。
上图利用了默认情况下仅支持 L4 负载平衡(仅循环法)的 Kubernetes 服务。因此,假设 tomcat 服务器负载很重,循环法不会根据使用情况平均分配负载。如何根据系统资源消耗或使用情况或否实现负载分配。上述拓扑中打开的连接数?
注:没有。上图中的矩形框仅供参考。我将每层部署 10 到 20 个 pods 来满足我的工作量。
- If Kubernetes service a single point of failure or because it is supported by multiple pods on which kube-proxy is configured and services is just a virtual layer, it cannot be considered as single point of failure?
我认为你后一种解释是正确的。
- Above diagram is a single Kubernetes cluster, is this a single point of failure or should I plan for multiple Kubernetes cluster for system where I need to support HA with zero downtime.
k8s集群没有HA,因为master节点是单点故障。主节点上的重要组件包括 apiserver 和控制器管理器,没有它们你无法创建更多 pods 或服务。也就是说,即使主节点关闭,您部署的服务也应该继续工作。
有一个关于如何在 HA 模式下设置 k8s 集群的指南,虽然我没有亲自尝试过:http://kubernetes.io/docs/admin/high-availability/. Also there is Ubernetes (WIP),它允许您跨云提供商联合多个 k8s 集群。
- Above diagram leverages Kubernetes services which by default supports only L4 Load balancing (round robin only).
这不是真的,kubernetes 有 beta 功能叫做 ingress,它支持 L7 负载平衡,看看它是否有帮助 http://kubernetes.io/docs/user-guide/ingress/ :)
以下 Kubernetes 的 50+ pods(计划在不久的将来扩展到 250+)内部部署成功上线是我和我的团队收集的经验观察:
- If Kubernetes service a single point of failure or because it is supported by multiple pods on which kube-proxy is configured and services is just a virtual layer, it cannot be considered as single point of failure?
如果负载平衡器 (LB) 映射到单个节点 IP,则将是单点故障,因为该 VM/物理服务器的故障将导致整个应用程序崩溃。因此,将 LB 指向至少 2 个不同的节点 IP。
- Above diagram is a single Kubernetes cluster, is this a single point of failure or should I plan for multiple Kubernetes cluster for system where I need to support HA with zero downtime.
使用负载均衡器在 HA 中配置 Kubernetes
- Above diagram leverages Kubernetes services which by default supports only L4 Load balancing (round robin only). Hence say a tomcat server is heavily loaded, round robin will not distribute load evenly based on usage. How to achieve load distribution based upon system resource consumption or usage or no. of open connections in the above topology?
是的,目前仅支持循环负载平衡。 Ingress 处于测试阶段,在我上次检查时尚未准备好投入生产。 NGINX+ 可用于负载平衡,忽略 Kubernetes 负载平衡并使用 Kubernetes API,它可以配置为添加或删除 Tomcat Pods 在运行时在 NGINX+ 中更新,无需任何停机时间。 (我还没有尝试过,但如果当前设置引发任何挑战,将来可能会考虑)
参考:https://www.nginx.com/blog/load-balancing-kubernetes-services-nginx-plus/