azurekuberneteskubernetes-ingressazure-aksazure-application-gateway

Troubleshooting Rule Priority Configuration in Azure Application Gateway Ingress for Kubernetes


Is there a method to define rule priority within the Azure Application Gateway?

I've defined an ingress object in my Kubernetes cluster as follows:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress
  annotations:
    appgw.ingress.kubernetes.io/rule-priority: "100"
spec:
  ingressClassName: azure-application-gateway
  rules:
  - host: foo.bar.io
    http:
      paths:
      - path: /
        backend:
          service:
            name: type
            port:
              number: 80
        pathType: Exact

This setup generates a listener and an associated rule, which works just fine. However, it appears that the annotation appgw.ingress.kubernetes.io/rule-priority: "100" doesn't have any effect.

When I inspect the rule in the console, it displays 19000 instead of 100.

I'm now wondering if the rule priority might be configured elsewhere or if I'm using the incorrect annotation altogether, as I don't find it listed among the supported annotations.

Is it possible to set the rule-priority from the ingress definition or is this done somewhere else entirely?


Solution

  • I compared with your list annotation, even as per MsDoc it is not listed.

    You can edit or modify your priority value from the console like below:

    enter image description here

    Alternatively, you can also try setting up rule priority between 1 and 20000 (1 = highest priority, 20000=lowest priority) as per below script by megabit

    $AppGW = Get-AzApplicationGateway -Name "<APPGATEWAYNAME>" -ResourceGroupName "<RGName>"
    $Rules = Get-AzApplicationGatewayRequestRoutingRule -ApplicationGateway $AppGW
    
    $i = 1000
    foreach ($Rule in $Rules) {
        $Rule.Priority = $i
        $i++
    }
    Set-AzApplicationGateway -ApplicationGateway $AppGw