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