Home > Software design >  Azure ContainerApps: error parsing cpu metadata: no type given in neither trigger.metadata.type or t
Azure ContainerApps: error parsing cpu metadata: no type given in neither trigger.metadata.type or t

Time:12-07

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...

CodePudding user response:

You want a JSON that looks like

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

note the metadata property.

See: https://learn.microsoft.com/en-us/azure/container-apps/scale-app#cpu

  • Related