Score:0

AKS Multiple Nginx Ingress with internal LB

jp flag

Azure Kubernetes - AKS - K8s version - 1.20.9.

Trying to setup multiple nginx ingress with Internal LB.

ingress controller with ingress-class -

helm install test1  ingress-nginx/ingress-nginx \
    --set controller.replicaCount=1  \
     --set controller.nodeSelector."beta\.kubernetes\.io/os"=linux \
     --set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux \
     --set controller.ingressClassResource.name=test1 \
     --set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-internal"=true

after installation LB services and Ingress Class created.

service -

test1-ingress-nginx-controller             LoadBalancer   10.0.52.125    10.240.0.4      80:32472/TCP,443:30586/TCP   4h9m
test1-ingress-nginx-controller-admission   ClusterIP      10.0.32.211    <none>          443/TCP                      4h9m

IngressClass -

NAME    CONTROLLER             PARAMETERS   AGE
test1   k8s.io/test1           <none>       155m

Ingress file

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: hello-world-ingress-my-external
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: test1
  rules:
   - host: test1.com
     http:
      paths:
      - backend:
          serviceName: aks-helloworld
          servicePort: 80
        path: /app(.*)
      - backend:
          serviceName: ingress-demo
          servicePort: 80
        path: /hello-world-two(/|$)(.*)

Ingress-2

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: hello-world-ingress-my-external
  annotations:
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: test2
  rules:
   - host: test2.com
     http:
      paths:
      - backend:
          serviceName: helloworld
          servicePort: 80
        path: /app(.*)
      - backend:
          serviceName: demo
          servicePort: 80
        path: /hello(/|$)(.*)

after creating ingress only first ip showing

NAME                              CLASS   HOSTS       ADDRESS   PORTS   AGE
external-ingress                  test1   test4.com  10.0.240.6        80      67m
hello-world-ingress-my-external   test2   test3.com  10.0.240.6        80      104

Traffic not updating based on IngressClass. please help, why same ip for all ingress ? also how can serve traffic based on ingressclass ?

Thanks in advance.

UPDATE - I am able to manage traffics with multiple ingress after updating

--set controller.ingressClass=test \
 --set controller.ingressClassResource.name=test --set controller.ingressClassResource.controllerValue="k8s.io/test-controller"

final helm command

helm install test1 ingress-nginx/ingress-nginx --set controller.ingressClass=test1 --set controller.ingressClassResource.name=test1 --set controller.ingressClassResource.controllerValue="k8s.io/test1-controller" \ 
--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-internal"=true

Still Ingress not showing ip

NAME                              CLASS     HOSTS       ADDRESS   PORTS   AGE
external-ingress                  test1 test3.com             80      19m
hello-world-ingress-my-external   test2 test1.com             80      33m
c4f4t0r avatar
nl flag
did you install a second ingress controller with the class name test2?
sanjayparmar avatar
jp flag
yes, install second ingress class test2
c4f4t0r avatar
nl flag
From your command I don't see the second ingress controller installation using helm
sanjayparmar avatar
jp flag
i used below command. use name test 1 and test 2. Now only issue is Ingress not showing ip `helm install test2 ingress-nginx/ingress-nginx --set controller.ingressClass=test1 --set controller.ingressClassResource.name=test2 --set controller.ingressClassResource.controllerValue="k8s.io/test2-controller" \ --set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-internal"=true`
c4f4t0r avatar
nl flag
could you check the service of the second ingress controller? kubectl get svc
sanjayparmar avatar
jp flag
yes checked. pods and services status are healthy . Only issue is, not assigning ip to ingress ( showing first ingress ip to all other ingress )
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.