我在GKE上运行k8s集群
它有4个具有不同配置的节点池
节点池:1 (单节点已维护状态)
运行 Redis和RabbitMQ
节点池:2 (单节点已维护状态)
运行监控和Prometheus
节点池:3 (大的大型单节点)
应用 pods
节点池:4 (启用了自动缩放的单节点)
应用 pods
当前,我在GKE上为每个服务运行单个副本
但是,主要管理所有内容的3个主要服务副本。
当使用HPA扩展此主要服务时,有时会看到节点崩溃或kubelet frequent restart
POD变为未知状态的问题。
如何处理这种情况?如果节点崩溃,GKE将花费时间进行自动修复,这会导致服务停机。
问题:2
节点池:3 -4个正在运行的应用程序POD。在应用程序内部,有3-4个内存密集型微服务,我也想使用节点选择器并将其修复在一个节点上。
而只有小型节点池将运行具有HPA的主服务,并且该节点池的节点自动扩展自动工作。
但是我觉得用Node选择器并不是最好的方法。
最好始终为每个服务运行多个副本,但是目前,我们仅对每个服务运行单个副本,因此请考虑考虑该部分。
最佳答案
正如Patrick W在他的评论中正确建议的那样:
if you have a single node, you leave yourself with a single point of failure. Also keep in mind that autoscaling takes time to kick in and is based on resource requests. If your node suffers OOM because of memory intensive workloads, you need to readjust your memory requests and limits – Patrick W Oct 10 at
您可能需要重新设计基础架构,以便在每个节点池以及readjust mamory requests and limits中拥有多个节点
您可能想看看官方kubernetes文档和 Google Cloud博客中的以下部分:
How to handle this scenario ? If the node gets crashed GKE taking time to auto repair and which cause service down time.
这就是为什么一个节点池中不止一个节点可能是更好的选择的原因。它大大降低了您遇到上述情况的可能性。 GKE autorapair 功能需要花费时间(通常是几分钟),如果这是您唯一的节点,则您无法做很多事情,需要接受可能的停机时间。
Node pool : 3 -4 running application PODs. Inside the application, there are 3-4 memory-intensive micro services i am also thinking same to use Node selector and fix it on one Node.
while only small node pool will run main service which has HPA and node auto scaling auto work for that node pool.
however i feel like it's not best way to it with Node selector.
您也可以在node affinity and anti-affinity和taints and tolerations上抢劫
关于docker - 在Kubernetes中调度和扩展Pod,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64287099/