Azure Application Gateway Ingress for Kubernetes中的规则优先级配置故障排除

cygmwpex  于 12个月前  发布在  Kubernetes
关注(0)|答案(1)|浏览(71)

是否有方法在Azure应用程序网关中定义规则优先级?
我在Kubernetes集群中定义了一个ingress对象,如下所示:

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

这个设置生成了一个侦听器和一个关联的规则,它们工作得很好。但是,注解appgw.ingress.kubernetes.io/rule-priority: "100"似乎没有任何效果。
当我在控制台中检查规则时,它显示19000而不是100。
我现在想知道规则优先级是否可能在其他地方配置,或者我是否使用了完全错误的注解,因为我没有发现它列在支持的annotations.
是否可以从入口定义设置规则优先级,或者完全在其他地方完成?

vwkv1x7d

vwkv1x7d1#

我比较了你的名单annotation,即使按照MsDoc它没有列出。
您可以从控制台编辑或修改您的优先级值,如下所示:

或者,您也可以按照下面的脚本 * 兆位 *,尝试将规则优先级设置为1到20000之间(1 =最高优先级,20000=最低优先级)

$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

相关问题