是否有一种方法可以在 Azure 应用程序网关中定义规则优先级?
我在 Kubernetes 集群中定义了一个入口对象,如下所示:
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. 中。
是否可以从入口定义中设置规则优先级,还是完全在其他地方完成?
最佳答案
我与你的列表进行了比较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
关于azure - 对 Kubernetes 的 Azure 应用程序网关入口中的规则优先级配置进行故障排除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/77177862/