Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return 503 by default when no endpoint is available #1513

Merged
merged 1 commit into from
Oct 9, 2017

Conversation

maxlaverse
Copy link
Contributor

@maxlaverse maxlaverse commented Oct 9, 2017

Return 503 by default when no endpoint is available

What this PR does / why we need it:
This PRs changes the backend of a location to be empty per default instead of "upstream-default-backend". During template rendering, if the backend of a location is empty, a 503 is returned to the client.

Which issue this PR fixes
Currently, if no endpoint is available for an upstream, the backends of locations using that upstream will be set to the default-backend.

This means that a client might get a 404under heavy load when no end-points are available. This sound wrong has clients interpret 404 as a valid response meaning the resource doesn't exist. I think that instead of a 404, the answer should be a 503 Service Unavailable (The server is currently unable to handle the request).

The definition of the default backend from the documentation says it's a service [for] handling all url paths and hosts the nginx controller doesn't understand.

I think that perfectly fine and would like not to use it anymore for upstreams without endpoints, which the Nginx Controller knows about but are simply temporarily unavailable.

Special notes for your reviewer
I didn't tested the behavior when using a custom-default-backend, but I expect it to be unchanged by this PR.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 9, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 9, 2017
@coveralls
Copy link

Coverage Status

Coverage remained the same at 33.492% when pulling 1062340 on maxlaverse:return_503_by_default into 8b94f46 on kubernetes:master.

@aledbf
Copy link
Member

aledbf commented Oct 9, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 9, 2017
@aledbf
Copy link
Member

aledbf commented Oct 9, 2017

@maxlaverse thanks!

@joshbranham
Copy link

I am not sure if this is relevant here, but I am trying to utilize the custom-default-backend to serve custom 50x error pages, as well as a custom 404. The 404 page works as expected, however when the nginx controller has no valid endpoints for a rule, it seems to just display its own 503 error page. Does this PR reflect that I need to custom the 503 page inside each ingress-controller, versus allowing the default backend to handle it as stated here: https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/customization/custom-errors/README.md

@joshbranham
Copy link

I solved my above issue by adding the custom config map value of custom-http-errors: 404,502,503,504. This seemed a bit unclear given the docs on custom-errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants