Ingress - Why do I need a default backend?

2,202 views
Skip to first unread message

bg303

unread,
Feb 8, 2018, 12:47:02 PM2/8/18
to Kubernetes user discussion and Q&A
I'm following this very helpful tutorial:

https://medium.com/@gokulc/setting-up-nginx-ingress-on-kubernetes-2b733d8d2f45

In the tutorial, we set up a default backend using an image from `gcr.io/google_containers/defaultbackend:1.0` - this service exposes a /healthz endpoint that returns a 200, a / endpoint that returns 404.

Finally, we add an Ingress that directs traffic a a domain, say example.com, to a Deployment which is running an application that has exactly one route: /:name

When it is all said and done, I can access example.com/:name and indeed, my request is routed to the deployment.

If I load example.com/ i get the 404 page.

If I load example.com/:name:/randomstring, i get the 404 page of the default backend.

Why would I ever want that functionality? Any Deployment that is running in the cluster and using the Ingress should be capable of returning a 404 for a route that isn't in the app's internal route table.

I want to replace the hello-world service with own image, a web server that actually does return stuff on the / route. And more importantly, if a user loads a route that doesn't exist, I do NOT want that request routed the backend. My service logs 404 requests and shows a 404 page. Do a still want a default backend? Why? How do I have the default backend not highjack my / route and my 404s?

Very confused. I appreciate any help. Thanks.


Mauricio Saenz

unread,
Feb 8, 2018, 1:09:42 PM2/8/18
to kubernet...@googlegroups.com
Hi

In order to use ingress you must need a ingress controller on your cluster

Regards
> --
> You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-use...@googlegroups.com.
> To post to this group, send email to kubernet...@googlegroups.com.
> Visit this group at https://groups.google.com/group/kubernetes-users.
> For more options, visit https://groups.google.com/d/optout.

Matt Brown

unread,
Feb 9, 2018, 8:51:09 AM2/9/18
to Kubernetes user discussion and Q&A
Can you share the definition of your Ingress resource?
Reply all
Reply to author
Forward
0 new messages