-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
kubens is very slow with large list of namespace #313
Comments
That's definitely an outlier case. :) As a result I can't promise any fixes. First and foremost, the bash based implementation likely can't fix this, so we might try to improve this in the Go implementation. Next, caching would only work if the Kubernetes API provides an I need someone to research if Kubernetes API supports cache control via |
Kubernetes API Server doesn't support cache control via Etag and If-None-Match (expect for OpenAPI schemas). Caching is disabled on purpose for security reasons — generaly we don't want to cache authz/authn protected content or proxy servers and end users machines. However, it doesn't mean we can't make our own cache implementation and I think we should. I suggest to use “stale while revalidate” approach: show user results from cache and fetch updated results for namespaces. By the way, we have maximum of 120 namespaces in cluster but my internet connection is not very good (good enough for video call through) so I'm ready to create a PR with caching if you like my “stale while revalidate” idea |
Workaround: use this two bash functions:
|
That's a good workaround, thanks @Nitive. I also like your caching idea! I have been using the small function below so far, because
|
Awesome @nhat @Nitive ! Thanks - I kind of combined both your approaches into this - in order to not need kubectl for setting the new Namespace. And also tweaked the output - because some cluster-contexts, especially from EKS gave me trouble
|
In my company we have about 22k namespaces. Switching ns with kubens is painfully slow and can take up to 10-15sec.
Do you have any plans to cache the ns list or are there any workarounds I can use for now?
The text was updated successfully, but these errors were encountered: