3

I am trying to deploy AKS with application gateway ingress controller via terraform. For which I have created application gateway , AKS (also enabled ingress controller setting) and then deployed YAML file with kind=ingress.

  1. Now, for the first time when application gateway is getting created it is creating backend pool with name which I have provided in terraform script (lets say terraform-backend-pool) .So here backend pool = terraform-backend-pool

  2. Then when I am deploying ingress Yaml file, earlier backend pool is getting replaced with two new backend pool by ingress controller (defaultaddresspool and pool-default-xxxx-service).So here backend pool = defaultaddresspool and pool-default-xxxx-service

  3. My concerns starts when the same terraform script gets executed second time. Since backend pool is not the same as script, it deletes them and creates one mentioned in the script and thus my service is not working properly.So here backend pool = terraform-backend-pool once again.

  4. One workaround which I have thought of is to delete the ingress YAML once again and deploy it again in CICD process. But this is not the practical approach , so need suggestion how I can avoid updating of backend pool.

Along with backend pool , routing rule are also getting updated in similar way.

I also thought of creating application gateway via AKS ingress option instead of creating it separately but through this option it is creating standard_V2 application gateway and I was planning to have WAF enabled application gateway.

SK001
  • 31
  • 1

1 Answers1

0

My workaround

ingress_pods=`kubectl -n kube-system  get pod  | awk '{if ($1 ~ "ingress-appgw-deployment-") print $1}'`
kubectl -n kube-system delete pod $ingress_pods
  • I used lifecycle ignore_changes option available in terraform ,which will indicate terraform to ignore the changes made in backend pool ,routing rule ,tags etc of application gateway. – SK001 Oct 06 '21 at 13:42