kubernetes Azure ContainerApps: error parsing cpu metadata: no type given in neither trigger.metadata.type or trigger.metricType?

2cmtqfgy  于 2022-12-11  发布在  Kubernetes
关注(0)|答案(1)|浏览(101)

I been trying yo scale out replicas through cpu load in to my container... but doesn't scale...
My scale rules:

"scale": {
        "maxReplicas": 3,
        "minReplicas": 0,
        "rules": [
          {
            "custom": {
              "metadata": {
                "AverageValue": "15"
              },
              "type": "cpu"
            },
            "name": "custom"
          }
        ]
      }

(also tried "Utilization" in metadata), so i checked the system log and i got this error:
error parsing cpu metadata: no type given in neither trigger.metadata.type or trigger.metricType
And:
Failed to ensure HPA is correctly created for ScaledObject
So i tried to change metadata and type for trigger.metadata.type and trigger.metricType, like this (this in yaml):

scale:
  minReplicas: 0
  maxReplicas: 3
  rules:
  - name: cpu
    custom:
      trigger.metricType: cpu
      trigger.metadata.type:
        AverageValue: '15'

Output:
(ContainerAppInvalidScaleRulesSpec) The scale rule 'custom' provided for Container App '******-dev' is invalid must have either Azure Queue or HTTP or Custom Rule specified.
What is wrong?
Scale a container through CPU load...

vxqlmq5t

vxqlmq5t1#

您需要一个如下所示的JSON

"scale": {
        "maxReplicas": 3,
        "minReplicas": 0,
        "rules": [
          {
            "custom": {
              "metadata": {
                "value": "15",
                "type": "AverageValue"
              },
              "type": "cpu"
            },
            "name": "custom"
          }
        ]
      }

请注意metadata属性。
请访问:https://learn.microsoft.com/en-us/azure/container-apps/scale-app#cpu

相关问题