-
Notifications
You must be signed in to change notification settings - Fork 884
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
kubectl completion, config current-context and version commands are too slow #1546
Comments
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/sig cli |
/transfer kubectl |
I'm not sure there is a completion functionality in Have you run these commands with |
Unfortunately only $ time kubectl version -v=9
I0119 14:18:55.658263 3484916 loader.go:373] Config loaded from file: /home/yorik/.kube/config
I0119 14:18:55.658919 3484916 round_trippers.go:466] curl -v -XGET -H "Accept: application/json, */*" -H "User-Agent: kubectl/v1.27.9 (linux/amd64) kubernetes/8b508a3" 'https://10.xxxxxxxx/version?timeout=32s'
I0119 14:19:25.660146 3484916 round_trippers.go:508] HTTP Trace: Dial to tcp:10.xxxxxxxx:443 failed: dial tcp 10.xxxxxxxx:443: i/o timeout
I0119 14:19:25.660682 3484916 round_trippers.go:553] GET https://10.xxxxxxxx/version?timeout=32s in 30001 milliseconds
I0119 14:19:25.660736 3484916 round_trippers.go:570] HTTP Statistics: DNSLookup 0 ms Dial 30001 ms TLSHandshake 0 ms Duration 30001 ms
I0119 14:19:25.660766 3484916 round_trippers.go:577] Response Headers:
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"27+", GitVersion:"v1.27.9-dispatcher", GitCommit:"8b508a33aafcd3ba51641b6b2ef203adbdd9de1e", GitTreeState:"clean", BuildDate:"2023-12-21T23:22:51Z", GoVersion:"go1.20.12", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v5.0.1
I0119 14:19:25.661042 3484916 helpers.go:264] Connection error: Get https://10.xxxxxxxx/version?timeout=32s: dial tcp 10.xxxxxxxx:443: i/o timeout
Unable to connect to the server: dial tcp 10.xxxxxxxx:443: i/o timeout
kubectl version -v=9 0.49s user 0.09s system 1% cpu 35.075 total
$ time kubectl completion zsh -v=9 [removed completion code]
kubectl completion zsh -v=9 0.05s user 0.03s system 1% cpu 5.068 total
$ time kubectl config current-context -v=9
I0119 14:20:30.727520 3486678 loader.go:373] Config loaded from file: /home/yorik/.kube/config
XXXXXXXXXXXXXXX
kubectl config current-context -v=9 0.05s user 0.02s system 1% cpu 5.053 total |
You can use |
I don't think that |
I think, there is some confusion. This issue is about kubernetes/kubernetes#82883 completion functionality works slowly. Because completion relies on retrieval data from server and if the connection is slow, completion does not work performant. On the other hand, the commands in this issue are not related to the completion;
I don't see any bug or issue and I'd prefer closing this as not a bug. Thanks for spending time and effort on this. |
$ time kubectl version --client -v=9 [14:47:22]
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"27+", GitVersion:"v1.27.9-dispatcher", GitCommit:"8b508a33aafcd3ba51641b6b2ef203adbdd9de1e", GitTreeState:"clean", BuildDate:"2023-12-21T23:22:51Z", GoVersion:"go1.20.12", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v5.0.1
kubectl version --client -v=9 0.11s user 0.02s system 2% cpu 5.109 total
$ strace -e trace=open,openat,close,read,write,connect,accept -ff kubectl completion zsh
openat(AT_FDCWD, "/sys/kernel/mm/transparent_hugepage/hpage_pmd_size", O_RDONLY) = 3
read(3, "2097152\n", 20) = 8
close(3) = 0
strace: Process 3519957 attached
strace: Process 3519958 attached
strace: Process 3519959 attached
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
strace: Process 3519960 attached
[pid 3519956] openat(AT_FDCWD, "/usr/lib/google-cloud-sdk/bin/kubectl", O_RDONLY|O_CLOEXEC) = 3
[pid 3519956] close(3) = 0
strace: Process 3519961 attached
strace: Process 3519962 attached
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519962] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
strace: Process 3519963 attached
strace: Process 3519964 attached
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
strace: Process 3519965 attached
[pid 3519961] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
strace: Process 3519966 attached
[pid 3519960] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519964] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519963] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519959] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519961] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519966] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519964] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
strace: Process 3519967 attached
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519961] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] openat(AT_FDCWD, "/home/yorik/.kube/config", O_RDONLY|O_CLOEXEC) = 3
[pid 3519956] read(3, "apiVersion: v1\nclusters:\n- clust"..., 36080) = 36079
[pid 3519956] read(3, "", 1) = 0
[pid 3519956] close(3) = 0
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519966] write(7, "\0", 1strace: Process 3519968 attached
) = 1
[pid 3519963] read(6, "\0", 16) = 1
[pid 3519966] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519963] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519956] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519960] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519966] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519966] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
[pid 3519966] --- SIGURG {si_signo=SIGURG, si_code=SI_TKILL, si_pid=3519956, si_uid=1000} ---
strace: Process 3519969 attached
[pid 3519966] close(10) = 0
[pid 3519966] read(9, "", 8) = 0
[pid 3519966] close(9) = 0
[pid 3519966] close(8) = 0
[pid 3519956] read(3, 0xc0005ce400, 512) = -1 EAGAIN (Resource temporarily unavailable)
[pid 3519969] openat(AT_FDCWD, "/sys/kernel/mm/transparent_hugepage/hpage_pmd_size", O_RDONLY) = 3
[pid 3519969] read(3, "2097152\n", 20) = 8
[pid 3519969] close(3) = 0
strace: Process 3519970 attached
strace: Process 3519971 attached
strace: Process 3519972 attached
strace: Process 3519973 attached
[pid 3519969] openat(AT_FDCWD, "/home/yorik/.kube/gke_gcloud_auth_plugin_cache", O_RDONLY|O_CLOEXEC) = 3
[pid 3519969] read(3, "{\n \"current_context\": \"XXXXXX"..., 512) = 360
[pid 3519969] read(3, "", 152) = 0
[pid 3519969] close(3) = 0
[pid 3519969] openat(AT_FDCWD, "/home/yorik/.kube/config", O_RDONLY|O_CLOEXEC) = 3
[pid 3519969] read(3, "apiVersion: v1\nclusters:\n- clust"..., 36080) = 36079
[pid 3519969] read(3, "", 1) = 0
[pid 3519969] close(3) = 0
[pid 3519969] write(1, "{\n \"kind\": \"ExecCredential\",\n"..., 464) = 464
[pid 3519961] read(3, "{\n \"kind\": \"ExecCredential\",\n"..., 512) = 464
[pid 3519972] +++ exited with 0 +++
[pid 3519971] +++ exited with 0 +++
[pid 3519970] +++ exited with 0 +++
[pid 3519961] read(3, 0xc000bdc1d0, 560) = -1 EAGAIN (Resource temporarily unavailable)
[pid 3519973] +++ exited with 0 +++
[pid 3519969] +++ exited with 0 +++
[pid 3519966] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3519969, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
[pid 3519961] read(3, "", 560) = 0
[pid 3519961] close(3) = 0
[pid 3519961] connect(3, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("10.xxxxxxxx")}, 16) = -1 EINPROGRESS (Operation now in progress)
[pid 3519956] close(3) = 0
[pid 3519966] write(7, "\0", 1) = 1
[pid 3519956] read(6, "\0", 16) = 1
[pid 3519966] write(1, "#compdef kubectl\ncompdef _kubect"..., 42#compdef kubectl
compdef _kubectl kubectl
) = 42 |
@yorik I compiled kubelet from source, on Can you try compiling from source or downgrading?
P.S I agree that this has nothing to do with kubernetes/kubernetes#82883 |
To be honest, I don't care about speed of I've also found this in strace:
So maybe it's |
I saw in your logs about |
I'd not consider as a fault but perhaps this plugin sends requests for authentication, etc. |
Running without the config helps:
I have something like this in my config:
But my main point that for commands which can be processed locally I can "fix" Just in case: $ gke-gcloud-auth-plugin --version Kubernetes v1.28.2-alpha+58ec6ae34b7dcd9699b37986ccb12b3bbac88f00 |
I've tried to downgrade to
I'll try to build |
If |
I've tested it with Also I wasn't able to find git commit 8b508a33aafcd3ba51641b6b2ef203adbdd9de1e in the repo from kubectl version installed from https://packages.cloud.google.com/apt, so maybe there are some google's patches added. |
I found that it's normal when I use kubectl@v1.23.5, but it will be very slow when I switch kubectl into v1.29.1.
|
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
What happened?
Commands
kubectl completion zsh
,kubectl config current-context
,kubectl version
and many others are too slow because they are trying to connect to the server.This is very annoying behaviour which causes slow opening of new terminal (~0.5s with VPN and ~5s without VPN, when connection isn't possible).
I don't see any reason for those commands to connect to any server, they should just return output locally.
What did you expect to happen?
All the commands run ~0.05s, like they do without any network connection:
How can we reproduce it (as minimally and precisely as possible)?
Without VPN:
With VPN connected (still annoyingly slow):
Anything else we need to know?
There was previous issue kubernetes/kubernetes#82883, which was closed without resolution, also please do not mark this as feature: it's a bug because
kubecli
can and should run the commands for ~0.05s but run for 0.5s or even 5s.Kubernetes version
Cloud provider
OS version
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, ...) and versions (if applicable)
The text was updated successfully, but these errors were encountered: