使用HELM的AGIC将监听器、规则等覆盖到使用共享APP网关的第二AKS



我有两个AKS (Dev和QA),我想与Azure中的一个APP网关共享。我使用HELM部署了AGIC,并在两个集群上启用了共享。使用YAML文件将入口部署到DEV,它工作得很好,但一旦我为QA部署相同的入口,它就会被defaultaddresspool覆盖。

我不确定是否因为我在YAML中为两个集群使用相同的域名?我们有不同的子域。

我们也在每个集群中使用相同的路径,但我认为这应该无关紧要,因为它们是两个独立的ak。

DEV yaml:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-api
namespace: default
annotations:
kubernetes.io/ingress.class: azure/application-gateway
appgw.ingress.kubernetes.io/backend-path-prefix: "/"
appgw.ingress.kubernetes.io/appgw-ssl-certificate: "wildcard-certificate"
appgw.ingress.kubernetes.io/ssl-redirect: "true"
spec:
rules:
- host: dev-api.example.com
- http:
paths:      
- path: /manager/*
pathType: Prefix
backend:
service:
name: manager-api
port:
number: 80

QA yaml:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-api
namespace: default
annotations:
kubernetes.io/ingress.class: azure/application-gateway
appgw.ingress.kubernetes.io/backend-path-prefix: "/"
appgw.ingress.kubernetes.io/appgw-ssl-certificate: "wildcard-certificate"
appgw.ingress.kubernetes.io/ssl-redirect: "true"
spec:
rules:
- host: test-api.example.com
- http:
paths:      
- path: /manager/*
pathType: Prefix
backend:
service:
name: manager-api
port:
number: 80

执掌版本Version . buildinfo {Version: v3.10.0", GitCommit:"ce66412a723e4d89555dc67217607c6579ffcb21", GitTreeState:"clean", GoVersion:"go1.18.6"}

曾经在Helm chart ingress-azure-1.5.2但是现在使用ingress-azure-1.6.0-rc1

我也尝试配置一些AzureIngressProhibitedTargets主机名,我不希望它触摸一旦创建,但由于有两个单独的AKS,我不认为这将是重要的。

我希望每个YAML为每个AKS DEV和QA创建入口侦听器,规则等。但是它用另一个覆盖了一个。

我的目标是有两个AKS共享一个应用程序网关,如果可能的话。

我发现了另一个注释添加到我的入口YAML,这有助于我的AzureIngressProhibitedTarget正确工作,不修改已经创建的内容。

注释为:appgw.ingress.kubernetes.io/hostname-extension

现在我可以使用两个集群共享APPGW,其中一个创建的入口不会影响另一个。

是的,您可以在两个AKS集群之间共享一个应用程序网关,但是您必须正确配置AzureIngressProhibitedTarget这样DEV AGIC就不会覆盖这里定义的QA AGIC。请参阅以下禁令。在DEV集群中配置

cat <<EOF | kubectl apply -f -
apiVersion: "appgw.ingress.k8s.io/v1"
kind: AzureIngressProhibitedTarget
metadata:
name: test-api-prohibition
spec:
hostname: test-api.example.com
EOF

在QA集群

cat <<EOF | kubectl apply -f -
apiVersion: "appgw.ingress.k8s.io/v1"
kind: AzureIngressProhibitedTarget
metadata:
name: dev-api-prohibition
spec:
hostname: dev-api.example.com
EOF

配置上面的禁止应该可以解决你的agic覆盖应用网关监听器配置的问题。

最新更新