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

Problem accessing gunicorn server from kubernets ingress #136

Closed
SuperCD opened this issue May 8, 2019 · 5 comments
Closed

Problem accessing gunicorn server from kubernets ingress #136

SuperCD opened this issue May 8, 2019 · 5 comments
Labels
bug Something isn't working

Comments

@SuperCD
Copy link

SuperCD commented May 8, 2019

Describe the bug
I created a deployment, service and ingress following the example in BentoML/examples/deploy-with-kubernetes/
(by the way the service-with-ingress.yaml contains an error. the service type is ClusterPort but should be ClusterIP)

The problem is that connections to the ingress are refused.

Even when tying to make requests directly to the pod on the 5000 port they get refused.

If I do a kubectl port-forward it works from localhost

I suppose that the problem is with the gunicorn bindings

this is the gunicorn log:
[2019-05-08 14:46:18 +0000] [1] [INFO] Starting gunicorn 19.9.0
[2019-05-08 14:46:18 +0000] [1] [INFO] Listening at: http://127.0.0.1:5000 (1)

and in the BentoML/bentoml/server/gunicorn_server.py file i see this:
def init(self, app, port, workers):
self.options = {'workers': workers, 'bind': '%s:%s' % ('127.0.0.1', port)}
self.application = app
super(GunicornApplication, self).init()

with 127.0.0.1 hardcoded in the code.

But I'm not completely sure that changing it to 0.0.0.0 would solve the problem.

@SuperCD SuperCD added the bug Something isn't working label May 8, 2019
@yubozhao
Copy link
Contributor

yubozhao commented May 8, 2019

@SuperCD Thanks for point it out!

We need to update the kubernetes example that works correctly with the Gunicorn deployment. We will hopefully get that fixed very soon.

Is this issue something very urgent with you? If it is, we will try our best to get it done sooner.

Feel free to ping me on this or any other questions!

@SuperCD
Copy link
Author

SuperCD commented May 9, 2019

thanks for the fast reply. I've tested it and in fact i was able to make it run if the binding is done on 0.0.0.0
I'm not even sure that changing the binding is the only way of solving this, but is the only one I've found...

@yubozhao
Copy link
Contributor

yubozhao commented May 9, 2019

Thanks for investigating @SuperCD!

I think you found the issue. Which is right now, the docker container right now is only listening localhost.

We will address this issue and also improve the experience for deploying with Docker. Those changes should solve the problem you are encountering now.

Just some idea in my head right now, I am thinking about using Nginx/gunicorn setup inside the docker container.

I will link the PR to this issue, hopefully I can get to it sometime close to next week or so. Feel free to ping me, if you need it before that. I will pump it up and work on it sooner

@yubozhao
Copy link
Contributor

yubozhao commented May 9, 2019

hi @SuperCD, I did a little bit more digging on this topic and We think your solution right now is the best one moving forward.

We did think about having an Nginx in the docker container as well. However, we realized that right now, most deployment solution probably already have an Nginx component that sits in front of the apps already (kubernetes' ingress controller for example). The Nginx won't bring too much value inside the container.

I think it is more fitting that you submit the PR to fix this problem since you provide the solution as well. What do you think? Otherwise, I will merge in the PR 138 that I linked above

@yubozhao
Copy link
Contributor

closing this issue now, since we merged in PR138. Feel free to open again, if there is additional issue relate to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants