簡體   English   中英

HorizontalPodAutoscaler 基於自定義指標的縮放 - 節點池級別指標

[英]HorizontalPodAutoscaler scaling based on custom metrics - node-pool level metric

我目前正在嘗試設置 GKE 集群並根據自定義指標(GPU 消耗)配置HorizontalPodAutoscaler ntalPodAutoscaler。 我有兩個節點池,我想根據每個node_pool的平均 GPU 消耗水平擴展它們。 我已經像這樣配置了兩個相同的 HPA:

apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: ner
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: ner
  minReplicas: 1
  maxReplicas: 10
  metrics:
    - type: External
      external:
        metric:
          name: kubernetes.io|container|accelerator|duty_cycle
        target:
          type: AverageValue
          averageValue: 60

我只替換了scaleTargetRef但事實證明這個指標似乎是在集群級別聚合的。 我已經仔細檢查了scaleTargetRef是否正確定義。

有沒有辦法按container_namenode_pool過濾指標? 任何其他建議都會很棒!

因此,我認為您正在尋找 k8 集群的指標,尤其是通過container_namenode_pool

您可以在 HPA 對象中使用五種類型的指標(autoscaling/v2beta2)

k explain HorizontalPodAutoscaler.spec.metrics.type  --api-version=autoscaling/v2beta2

編輯更新


apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: ner
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: ner
  minReplicas: 1
  maxReplicas: 10
  metrics:
    - type: ContainerResource
      containerResource:
        name: gpu
        container: your-application-container
        target:
          type: Utilization
          averageUtilization: 60

編輯更新

對於具有 Cloud Monitoring 指標的 GKP Autoscaling 部署

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM