-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Minikube kubectl autocompletion not working #14959
Comments
I can confirm |
/kind support |
same here |
I have just spent half day trying to make it to work and failed. I'm on Debian 11 Bullseye with bash. |
It appears to have been reported before but never fixed |
Using
You can see that it's evaluating $ kubectl __complete ge; echo $?
Error: flags cannot be placed before plugin name: --cluster
1 So it appears that since minikube is always adding some flags, the completion script ( |
It seems like a pretty simple fix: diff --git a/cmd/minikube/cmd/kubectl.go b/cmd/minikube/cmd/kubectl.go
index ace509340..26825b1c3 100644
--- a/cmd/minikube/cmd/kubectl.go
+++ b/cmd/minikube/cmd/kubectl.go
@@ -96,7 +96,7 @@ host. Please be aware that when using --ssh all paths will apply to the remote m
os.Exit(1)
}
- if len(args) > 1 && args[0] != "--help" {
+ if len(args) > 1 && args[0] != "--help" && args[0] != "__complete" {
cluster := []string{"--cluster", cname}
args = append(cluster, args...) Before: $ go run ./cmd/minikube kubectl __complete ge
Error: flags cannot be placed before plugin name: --cluster
exit status 1 After: $ go run ./cmd/minikube kubectl __complete ge
get Display one or many resources
:4
Completion ended with directive: ShellCompDirectiveNoFileComp I'll submit a PR. |
great job @ben-krieger - I can see you got your PR merged! Thank you, looking forward to the new release to test it! |
What Happened?
As the documentation specified I tried using the
kubectl
provided in the project using:sudo ln -s $(which minikube) /usr/local/bin/kubectl
I am on Ubuntu 22.04 and I tried both
bash
andzsh
. In both cases the autocompletion doesn't work. I tried multiple things, sourcing the auto completion manually and putting them in the configuration file for each respective shell:I tried using the
oh-my-zsh
plugin. Nothing - it just doesn't work.After installing a dedicated kubectl package via
snapd
everything works fine. There is just something wrong with the minikube setup.Attach the log file
Not applicable.
Operating System
Ubuntu
Driver
Docker
The text was updated successfully, but these errors were encountered: