gpt4 book ai didi

kubernetes - GKE上的联合Kubernetes集群中的HPA +集群自动缩放器+ OPA

转载 作者:行者123 更新时间:2023-12-02 11:49:07 25 4
gpt4 key购买 nike

我正在Google容器引擎(GKE)1.8.3-gke.0上使用kubefed建立一个联合的kubernetes集群。

对于一个好的HPAcluster autoscaler,由于kubernetes Admission Controller,我不得不使用Open Policy Agent作为this:

By default, replicas are spread equally in all the underlying clusters. For example: if you have 3 registered clusters and you create a Federated Deployment with spec.replicas = 9, then each Deployment in the 3 clusters will have spec.replicas=3.



但是在我的情况下,负载将在每个区域中动态变化,并且每个群集都应具有动态pod数量。

我找不到(或根本看不到)与我的案例有关的示例或手册。因此,问题是:

如果在联盟上下文中有三个集群,则策略应具有哪种方案,对于GKE 的每个区域,一个集群:
  • eu(1000 rps,标有“region = eu”的节点)
  • (200 rps,标有“region = us”的节点)
  • 亚洲(100 rps,标有“region = asia”的节点)

    这应该是一个单一部署,以便动态在这三个集群中分布Pod。

    一个 pod 应该:
  • 服务100 rps
  • 请求2个vCPU + 2Gb RAM
  • 仅(与anti-affinity)一起放置在节点上

  • 如果可能,如何配置OPA以使该模式起作用?

    在此先感谢您提供相应手册的链接。

    最佳答案

    您想做的事情应该可以通过“联邦水平Pod自动缩放器”实现,它们的主要用例之一就是您的方案:

    从联合Pod Autoscaler的Requirements & Design Document引用:

    Users can schedule replicas of same application, across the federated clusters, using replicaset (or deployment). Users however further might need to let the replicas be scaled independently in each cluster, depending on the current usage metrics of the replicas; including the CPU, memory and application defined custom metrics.



    actual documentation中得出结论的这一段描述了这种行为:

    The use of federated HPA is to ensure workload replicas move to the cluster(s) where they are needed most, or in other words where the load is beyond expected threshold. The federated HPA feature achieves this by manipulating the min and max replicas on the HPAs it creates in the federated clusters. It actually relies on the in-cluster HPA controllers to monitor the metrics and update relevant fields [...] The federated HPA controller, on the other hand, monitors only the cluster-specific HPA object fields and updates the min replica and max replica fields of those in cluster HPA objects, which have replicas matching thresholds.



    因此,如果我没有误解您的需求,则没有理由使用诸如Open Policy Agent的第三种产品或创建策略。

    关于kubernetes - GKE上的联合Kubernetes集群中的HPA +集群自动缩放器+ OPA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47429724/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com