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

Can't tune maxsize of connection pool used #290

Closed
yuvipanda opened this issue Jul 9, 2017 · 7 comments
Closed

Can't tune maxsize of connection pool used #290

yuvipanda opened this issue Jul 9, 2017 · 7 comments

Comments

@yuvipanda
Copy link
Contributor

I get a lot of log messages of the form:

WARNING:urllib3.connectionpool:Connection pool is full, discarding connection: 10.0.0.1

Setting maxsize of HTTPConnectionPool (or equivalent object) to something higher would help with this, and with connection re-use help performance too (I am hoping!). I can't seem to find a way to set this though!

@yuvipanda
Copy link
Contributor Author

Ideally, it'll be a param to kubernetes.config.configuration that can be tuned.

@yuvipanda
Copy link
Contributor Author

However, the kubernetes.config.configuration object says it is autogenerated - but am unable to find where it is autogenerated from?

@mbohlool
Copy link
Contributor

mbohlool commented Jul 9, 2017

kubernetes.config.configuration is not auto generated anymore, you can edit it. Please also remove the message that it said it is auto-generated. Thanks for your contribution.

@yuvipanda
Copy link
Contributor Author

Thanks @mbohlool! kubernetes-client/python-base#18 should do the trick I think.

@s1113950
Copy link

kubernetes.config.configuration is not auto generated anymore, you can edit it. Please also remove the message that it said it is auto-generated. Thanks for your contribution.

@mbohlool @yuvipanda how can you edit this? I have this setting because I'm threading grabbing pod information and ran into the connection pool issue above:

client_config = client.Configuration()
client_config.connection_pool_maxsize = 200
config.load_kube_config(client_configuration=client_config)
v1 = client.CoreV1Api()

if I then call pods = v1.list_namespaced_pod(namespace) I get an error where it hits localhost rather than using my kubeconfig.

I checked out the code here: https://github.com/kubernetes-client/python-base/blob/master/config/kube_config.py#L522 and thought that if I just pass in the client_configuration with the changed pool size it'd use that, but I'm overwriting something I don't mean to.

@mbohlool
Copy link
Contributor

you need to pass your client_config to client.CoreV1Api() call otherwise it will use the default one which is localhost. it should be something like client.CoreV1Api(config=client_config)

@s1113950
Copy link

s1113950 commented Oct 1, 2018

Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants