Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting All hosts are taken by other resources with Nginx Ingress Controller

I have setup Nginx Controller as mentioned in the docs https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/. I have setup the Ingress with the below configuration

IngressClass

apiVersion: networking.k8s.io/v1beta1
kind: IngressClass
metadata:
  name: nginx
  # annotations:
  #   ingressclass.kubernetes.io/is-default-class: "true"
spec:
  controller: nginx.org/ingress-controller

Ingress

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: hn-service-ingress
spec:
  ingressClassName: nginx
  rules:
  - host: hostnameservice.classpath.com
    http:
      paths:
      - path: /test
        backend:
          serviceName: hostname-service
          servicePort: 80

Below is the error when running the describe command. I am getting All hosts are taken by other resources

kubectl describe ingress hn-service-ingress
Name:             hn-service-ingress
Namespace:        pradeep
Address:
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
Rules:
  Host                           Path  Backends
  ----                           ----  --------
  hostnameservice.classpath.com
                                 /test    hostname-service:80 (100.96.1.12:8111,100.96.1.13:8111,100.96.2.13:8111)
Annotations:                     <none>
Events:
  Type     Reason    Age   From                      Message
  ----     ------    ----  ----                      -------
  Warning  Rejected  5s    nginx-ingress-controller  All hosts are taken by other resources

When I used to check with the cafe example, it is working fine. Where am I going wrong?

Note: I have configured the AWS load balancer and set the /etc/hosts to point to the ELB from AWS using the dnslookup.

like image 696
zilcuanu Avatar asked Oct 20 '25 14:10

zilcuanu


1 Answers

Please keep in mind that there are 3 types of Nginx. Open Source Nginx Ingress Controller, Nginx Incorporaton (nginx inc) and Nginx Incorporaton Plus.

As I mention in the comments, issue was casued by resources using the same host. It's called Host Collisions.

A host collision occurs when multiple resources configure the same host. The Ingress Controller supports two options for handling host collisions:

  • Choosing the Winner

If multiple resources contend for the same host, the Ingress Controller will pick the winner based on the creationTimestamp of the resources: the oldest resource will win. In case there are more than one oldest resources (their creationTimestamp is the same), the Ingress Controller will choose the resource with the lexicographically smallest uid.

  • Merging Configuration for the Same Host

It is possible to merge configuration for multiple Ingress resources for the same host. One common use case for this approach is distributing resources across multiple namespaces.

OP confirmed, that this was solved by changes made in another Ingress resource in another namespace.

I was able to resolve this. There was one more Ingress in another namespace

like image 118
PjoterS Avatar answered Oct 24 '25 09:10

PjoterS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!