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

Kubeconfig per invocation #586

Open
KnVerey opened this issue Oct 8, 2019 · 0 comments
Open

Kubeconfig per invocation #586

KnVerey opened this issue Oct 8, 2019 · 0 comments

Comments

@KnVerey
Copy link
Contributor

KnVerey commented Oct 8, 2019

Idea

It's necessarily true that each invocation of our tool only needs one of the clusters/contexts/users in the kubeconfig. If we constructed a tempfile containing only the information we actually need we could eliminate the sharing of this dependency between invocations (which is aesthetically nice--we don't mutate it of course!), guarantee we could only be using the right context, and reduce the size of the file kubectl repeatedly loads (see below).

For performance?

tl;dr Unlikely to help Shopify, unsure if it would help others

Last year, I did a bit of performance work on this gem using a watch command I didn't end up merging. One thing I found out was that kubectl get itself was a major contributor to sync cycle slowness at the time. I also discovered that kubectl versions < 1.14 have a bug where the kubeconfig is loaded repeatedly, which reported has severe performance implications if the file is large and/or the cluster has large numbers of resources. The maintainers refused to backport the fix. The number of times it is reloaded apparently scales up with the number of resources being retrieved, which we can't do much about. However, reducing the file size also helps, according the the bug report, and we do have control over that.

I believe I confirmed that we were affected at the time, but it was a long time ago and fell off my mental radar until recently. Today, on a Shipit instance (because a comment on the bug report suggests it may only affect linux), I did a get pods targeting one of our most populated clusters, and it only loaded the kubeconfig 4 times. So no quick win for us after all. It might still help others though.

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

1 participant