Private AKS Cluster || App gateway Ingress controller || <error: endpoints "default-http-backend" not found> || 404 - Bad gateway erro

Ankit Rathod 371 Reputation points
2021-08-25T17:24:02.243+00:00

hi team, i

'm trying to add multiple path as my routing for ingress controller - app gateway for my private AKS cluster

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: one-ingress
annotations:
kubernetes.io/ingress.class: azure/application-gateway
appgw.ingress.kubernetes.io/backend-path-prefix: /
spec:
rules:

- host: "20.xx.xx.xx"

  • http:
    paths:
    • path: /path_1
      backend:
      serviceName: ui-one
      servicePort: 80
    • path: /master-service/
      backend:
      serviceName: one-master
      servicePort: 80

but im not able to view application and error as below -

126445-image.png

when i do describe pod - <error: endpoints "default-http-backend" not found>

and when I access only IP I can see welcome to nginx page, but when i add path to the error i same again 404...

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
1,014 questions
Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,999 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SRIJIT-BOSE-MSFT 4,331 Reputation points Microsoft Employee
    2021-08-26T06:23:21+00:00

    @Ankit Rathod , Thank you for your question.

    If none of the hosts or paths match the HTTP request in the Ingress objects, the traffic is routed to your default backend. [Reference]

    With the following definition, let's say [Using apiVersion: networking.k8s.io/v1 since networking.k8s.io/v1beta1 has been deprecated] :

    apiVersion: networking.k8s.io/v1  
    kind: Ingress  
    metadata:  
      annotations:  
        appgw.ingress.kubernetes.io/backend-path-prefix: "/"  
        kubernetes.io/ingress.class: azure/application-gateway  
      name: myIngress  
    spec:  
      rules:  
      - http:  
          paths:  
          - backend:  
              service:  
                name: nginx  
                port:  
                  number: 80  
            path: /nginx  
            pathType: ImplementationSpecific  
          - backend:  
              service:  
                name: aspnetapp  
                port:  
                  number: 80  
            path: /asp  
            pathType: ImplementationSpecific  
    

    On kubectl apply (assuming that the backend services) are running, we get:

    kubectl get ingress  
    NAME        CLASS    HOSTS   ADDRESS        PORTS   AGE  
    myIngress   <none>   *       x.x.x.x        80      29m  
    
    kubectl describe ingress  
    Name:             myIngress  
    Namespace:        default  
    Address:          x.x.x.x  
    Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)  
    Rules:  
      Host        Path  Backends  
      ----        ----  --------  
      *  
                  /nginx   nginx:80 (10.244.0.8:80)  
                  /asp     aspnetapp:80 (10.244.0.7:80)  
    Annotations:  appgw.ingress.kubernetes.io/backend-path-prefix: /  
                  kubernetes.io/ingress.class: azure/application-gateway  
    Events:       <none>  
    

    Accessing the Applications:

    at x.x.x.x/nginx
    126549-image.png

    at x.x.x.x/asp
    126556-image.png

    However, as @Mohammad Ajmal Yazdani pointed out, if we try accessing x.x.x.x/nginx/anypathhere and x.x.x.x/asp/anypathhere the paths do not match the rules in the Ingress object because these paths were not mentioned in the Ingress spec.rules[].http.paths[].path to start with.

    In your case, you can have Ingress spec.rules[].http.paths[] item as follows:

    - backend:  
        service:  
          name: <your-backend-service-name>  
            port:  
               number: <corresponding-port-number>  
        path: /digital/admin  
        pathType: ImplementationSpecific  
    

    You can use the YAML manifest shared above and replace the Ingress metadata.name, spec.rules[].http.paths[].path, spec.rules[].http.paths[].backend.service.name and spec.rules[].http.paths[].backend.service.port.number appropriately.

    ----------

    Hope this helps.

    Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.

    1 person found this answer helpful.
    0 comments No comments