How can I disable the kubectl autocompletions functionality on zsh. I'm running on osx and the autocompletions are slow(probably because they have to call the remote cluster API) and I don't want them no more.
-
Have you checked this [documentation](https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion)? Have you tried to edit your `~/.zshrc`? – Dawid Kruk Feb 17 '20 at 10:22
-
Also .. don't press tab then ^^ ... maybe a too simple proposal as you could use auto completion when you need it still. – Flowkap Feb 17 '20 at 10:51
1 Answers
First of all, autocompletion in kubectl
command is not enabled by default. You needed to enable it beforehand. To disable it would be best just to reverse the steps you took to enable it.
How to enable autocompletion for kubectl
within zsh
environment:
The kubectl completion script for Zsh can be generated with the command
kubectl completion zsh
. Sourcing the completion script in your shell enables kubectl autocompletion.To do so in all your shell sessions, add the following to your
~/.zshrc
file:$ source <(kubectl completion zsh)
Following above example:
Command $ source <(kubectl completion zsh)
:
- can be run by itself in shell for autocompletion within current session
- can be put in
~/.zshrc
file to be loaded each time user logs in
After applying one of above solutions it should provide available options with TAB
keypress to type into terminal like below:
somefolder% kubectl get pod[TAB PRESSED HERE!]
poddisruptionbudgets.policy pods.metrics.k8s.io podsecuritypolicies.policy
pods podsecuritypolicies.extensions podtemplates
How to disable autocompletion for kubectl
within zsh
environment:
As said above autocompletion is not enabled by default. It can be disabled:
- when created for current session by:
- creating a new session (example
zsh
)
- creating a new session (example
- when edited
~/.zshrc
file by:- removing:
source <(kubectl completion zsh)
from~/.zshrc
file. - creating a new session (example
zsh
)
- removing:
After that autocompletion for kubectl
should not work.
Please let me know if you have any questions to that.

- 8,982
- 2
- 22
- 45