question

AnkitRathod-6794 avatar image
0 Votes"
AnkitRathod-6794 asked AnkitRathod-6794 commented

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

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-kubernetes-serviceazure-application-gateway
image.png (15.4 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Your path should be .....com/path_1 OR .....com/master-service. Do u any rule around ..../admin?

1 Vote 1 ·

by rule, do you mean redirection rule ?

0 Votes 0 ·

1 Answer

srbose-msft avatar image
1 Vote"
srbose-msft answered

@AnkitRathod-6794 , 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 @IamCoder-6455 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.


image.png (27.6 KiB)
image.png (49.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.