application-gateway-kubernetes-ingress icon indicating copy to clipboard operation
application-gateway-kubernetes-ingress copied to clipboard

When deploying an ingress to an AKS with multiple AGIC, it is configured on all AGICs

Open wshamroukh opened this issue 3 years ago • 2 comments
trafficstars

Describe the bug I have installed two AGIC each linked to a separate App Gateway. When deploying the an app with ingress while specifying the AGIC name using ingressClassName, the app is configured on both App Gateways.

To Reproduce Steps to reproduce the behavior:

  1. deploy two AGIC using helm configuration and https://github.com/Azure/application-gateway-kubernetes-ingress/blob/master/helm/ingress-azure/values.yaml#L56:
ingressClassResource:
  name: appgw1
  enabled: true
  default: false
  controllerValue: "azure/application-gateway"
ingressClassResource:
    name: appgw2
    enabled: true
    default: false
    controllerValue: "azure/application-gateway"
  1. Then deploying an ingress and mentioning the AGIC name:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: aspnetapp-ing
spec:
  ingressClassName: appgw1
  rules:
  - host: "foo.contoso.com"
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: aspnetapp-svc
            port: 
              number: 80

Ingress Controller details

  • Output of kb logs --follow appgw1-agic-ingress-azure-58644c647d-b89p8 .
I0207 22:45:39.136430       1 mutate_app_gateway.go:177] BEGIN AppGateway deployment
I0207 22:45:40.738154       1 client.go:201] OperationID='d70f9683-0343-499e-9b9d-b42791e6efd9'
I0207 22:45:45.777727       1 mutate_app_gateway.go:185] Applied generated Application Gateway configuration
I0207 22:45:45.777750       1 mutate_app_gateway.go:200] cache: Updated with latest applied config.
I0207 22:45:45.778344       1 mutate_app_gateway.go:204] END AppGateway deployment
I0207 22:45:45.778359       1 controller.go:151] Completed last event loop run in: 6.884760556s
I0207 22:45:46.824845       1 context.go:706] IP 20.74.xxx.xxx already set on Ingress default/aspnetapp-ing
I0207 22:45:46.825926       1 backendhttpsettings.go:89] Created backend http settings bp-default-aspnetapp-svc-80-80-aspnetapp-ing for ingress default/aspnetapp-ing and service default/aspnetapp-svc
I0207 22:45:46.833309       1 mutate_app_gateway.go:164] cache: Config has NOT changed! No need to connect to ARM.
I0207 22:45:46.833335       1 controller.go:151] Completed last event loop run in: 54.17514ms
I0207 22:45:47.884116       1 backendhttpsettings.go:89] Created backend http settings bp-default-aspnetapp-svc-80-80-aspnetapp-ing for ingress default/aspnetapp-ing and service default/aspnetapp-svc
I0207 22:45:47.897136       1 mutate_app_gateway.go:164] cache: Config has NOT changed! No need to connect to ARM.
I0207 22:45:47.897195       1 controller.go:151] Completed last event loop run in: 62.909234ms
I0207 22:45:48.943632       1 backendhttpsettings.go:89] Created backend http settings bp-default-aspnetapp-svc-80-80-aspnetapp-ing for ingress default/aspnetapp-ing and service default/aspnetapp-svc
I0207 22:45:48.951546       1 mutate_app_gateway.go:164] cache: Config has NOT changed! No need to connect to ARM.
I0207 22:45:48.951568       1 controller.go:151] Completed last event loop run in: 54.118359ms
I0207 22:45:50.010996       1 backendhttpsettings.go:89] Created backend http settings bp-default-aspnetapp-svc-80-80-aspnetapp-ing for ingress default/aspnetapp-ing and service default/aspnetapp-svc
I0207 22:45:50.018905       1 mutate_app_gateway.go:164] cache: Config has NOT changed! No need to connect to ARM.
I0207 22:45:50.018929       1 controller.go:151] Completed last event loop run in: 67.20427ms
I0207 22:45:51.078796       1 backendhttpsettings.go:89] Created backend http settings bp-default-aspnetapp-svc-80-80-aspnetapp-ing for ingress default/aspnetapp-ing and service default/aspnetapp-svc
I0207 22:45:51.088089       1 mutate_app_gateway.go:164] cache: Config has NOT changed! No need to connect to ARM.
I0207 22:45:51.088111       1 controller.go:151] Completed last event loop run in: 68.678483ms 
  • Output of ` kb logs --follow appgw2-agic-ingress-azure-684486988d-qgtgb.
I0207 22:45:39.111098       1 backendhttpsettings.go:89] Created backend http settings bp-default-aspnetapp-svc-80-80-aspnetapp-ing for ingress default/aspnetapp-ing and service default/aspnetapp-svc
I0207 22:45:39.119083       1 mutate_app_gateway.go:177] BEGIN AppGateway deployment
I0207 22:45:41.081348       1 client.go:201] OperationID='09cae1cf-f822-4a8f-a627-adc9891fbb4c'
I0207 22:45:46.135067       1 mutate_app_gateway.go:185] Applied generated Application Gateway configuration
I0207 22:45:46.135089       1 mutate_app_gateway.go:200] cache: Updated with latest applied config.
I0207 22:45:46.135858       1 mutate_app_gateway.go:204] END AppGateway deployment
I0207 22:45:46.135881       1 controller.go:151] Completed last event loop run in: 7.240586241s
I0207 22:45:47.212347       1 backendhttpsettings.go:89] Created backend http settings bp-default-aspnetapp-svc-80-80-aspnetapp-ing for ingress default/aspnetapp-ing and service default/aspnetapp-svc
I0207 22:45:47.219297       1 mutate_app_gateway.go:164] cache: Config has NOT changed! No need to connect to ARM.
I0207 22:45:47.219321       1 controller.go:151] Completed last event loop run in: 83.236289ms
I0207 22:45:48.283525       1 backendhttpsettings.go:89] Created backend http settings bp-default-aspnetapp-svc-80-80-aspnetapp-ing for ingress default/aspnetapp-ing and service default/aspnetapp-svc
I0207 22:45:48.294196       1 mutate_app_gateway.go:164] cache: Config has NOT changed! No need to connect to ARM.
I0207 22:45:48.294219       1 controller.go:151] Completed last event loop run in: 74.856249ms
I0207 22:45:49.344638       1 backendhttpsettings.go:89] Created backend http settings bp-default-aspnetapp-svc-80-80-aspnetapp-ing for ingress default/aspnetapp-ing and service default/aspnetapp-svc
I0207 22:45:49.351973       1 mutate_app_gateway.go:164] cache: Config has NOT changed! No need to connect to ARM.
I0207 22:45:49.351994       1 controller.go:151] Completed last event loop run in: 57.578761ms
  • And both app gateways get updated with backend, rules, http settings, ..etc but eventually the ingress is associated with AGIC#2:
kb get ingress
NAME            CLASS         HOSTS               ADDRESS         PORTS   AGE
aspnetapp-ing   appgw1-agic   foo.contoso.com   20.74.xxx.yyy  80      39s

wshamroukh avatar Feb 07 '22 22:02 wshamroukh

Have you tried installing your apps in different namespaces and then just have each AGIC watch a different namespace?

curious-toast avatar Feb 09 '22 00:02 curious-toast

Have you tried installing your apps in different namespaces and then just have each AGIC watch a different namespace?

That worked like a charm - thank you for your guidance.

wshamroukh avatar Feb 09 '22 09:02 wshamroukh