skip to Main Content

I have 3 ingress namespace in AKS Cluster. One of standart ingress deploy file, the other two are internal and external modified versions of the original file. So right now I have 3 ingress and 3 external ip(one of internal with adding service annotations this line service.beta.kubernetes.io/azure-load-balancer-internal: "true")

    $ kubectl get svc -A
external-ingress   ingress-nginx-controller             LoadBalancer   10.245.57.76     3.3.3.3   80:32112/TCP,443:31761/TCP   3h24m
external-ingress   ingress-nginx-controller-admission   ClusterIP      10.245.28.35     <none>    443/TCP                      3h24m
ingress-nginx      ingress-nginx-controller             LoadBalancer   10.245.12.12     1.1.1.1   80:31716/TCP,443:32023/TCP   40m
ingress-nginx      ingress-nginx-controller-admission   ClusterIP      10.245.110.233   <none>    443/TCP                      40m
internal-ingress   ingress-nginx-controller             LoadBalancer   10.245.173.35    2.2.2.2   80:32567/TCP,443:30296/TCP   3h25m
internal-ingress   ingress-nginx-controller-admission   ClusterIP      10.245.39.250    <none>    443/TCP                      3h25m

I want to use two of ingress but it doesn’t work as i think. I try to manage with " ingressClassName: " but it’s working unexpended.

$ kubectl get ing -w
NAME               CLASS              HOSTS         ADDRESS   PORTS     AGE
external-ingress   nginx              test.io       1.1.1.1   80, 443   3h4m
internal-ingress   internal-ingress   admin.test.io 1.1.1.1   80        3h4m
external-ingress   nginx              test.io       2.2.2.2   80, 443   3h5m
external-ingress   nginx              test.io       3.3.3.3   80, 443   3h5m
external-ingress   nginx              test.io       1.1.1.1   80, 443   3h5m
external-ingress   nginx              test.io       2.2.2.2   80, 443   3h6m
external-ingress   nginx              test.io       3.3.3.3   80, 443   3h6m
external-ingress   nginx              test.io       1.1.1.1   80, 443   3h6m
external-ingress   nginx              test.io       2.2.2.2   80, 443   3h7m
external-ingress   nginx              test.io       3.3.3.3   80, 443   3h7m
external-ingress   nginx              test.io       1.1.1.1   80, 443   3h7m
external-ingress   nginx              test.io       2.2.2.2   80, 443   3h8m
external-ingress   nginx              test.io       3.3.3.3   80, 443   3h8m

When I changed the "ingressClassName: nginx" External IP constantly changing. When I changed "ingressClassName: external-ingress" IP sometimes changing, sometimes not changing.. and when it’s chaning it’s not work..

original deployment file

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.3.0/deploy/static/provider/cloud/deploy.yaml

I create a external-ingress and internal-ingress with this file changing "ingress-nginx" line to "internal-nginx" and "external-nginx".

Why is the ip constantly changing?

2

Answers


  1. Chosen as BEST ANSWER

    my problem is about the IngressClass and Ingress installaion section. Unfortunately I had to use yaml while installing, but then I had to uninstall and reinstall, so there was a problem.

    Lesson learned from this process is use helm or be careful when using yaml.


  2. If the ingress resource is regularly changing external IPs, this indicates you have more than one ingress controller in the cluster and have not specified an ingress class on the ingress resource.

    As such, all ingress controllers in the cluster (which have not been restricted to namespace) will try to "fight" for management of the traffic going through that ingress, each time the winning controller will set the IP of the ingress to their own loadbalancer IP.

    This is why you’re seeing the IP of your ingress change to 1.1.1.1, 2.2.2.2, and 3.3.3.3 because these are the ingress controllers you have installed in your cluster, as per your snippet:

    $ kubectl get svc -A
    external-ingress   ingress-nginx-controller             LoadBalancer   10.245.57.76     3.3.3.3   80:32112/TCP,443:31761/TCP   3h24m
    external-ingress   ingress-nginx-controller-admission   ClusterIP      10.245.28.35     <none>    443/TCP                      3h24m
    ingress-nginx      ingress-nginx-controller             LoadBalancer   10.245.12.12     1.1.1.1   80:31716/TCP,443:32023/TCP   40m
    ingress-nginx      ingress-nginx-controller-admission   ClusterIP      10.245.110.233   <none>    443/TCP                      40m
    internal-ingress   ingress-nginx-controller             LoadBalancer   10.245.173.35    2.2.2.2   80:32567/TCP,443:30296/TCP   3h25m
    internal-ingress   ingress-nginx-controller-admission   ClusterIP      10.245.39.250    <none>    443/TCP                      3h25m
    

    You can fix this by ensuring all your ingress controllers are set to only watch for a specific ingress class and/or restricting the controllers to only manage a specific namespace, and making sure your ingress resource specifies an ingress class by the ingress-class annotation and/or the ingressClass block.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search