2025-12-19 03:28:56
Yes, the script emitted by "kubectl completion zsh" supports resource names!
#kubernetes #zsh #shell
Yes, the script emitted by "kubectl completion zsh" supports resource names!
#kubernetes #zsh #shell
Does there exist some zsh kubectl plugin/feature which provides tab-completion of (nouns from a cache of) *remote resource names*? I want this to work like local paths do for file arguments.
kubectl -n ku<TAB> get svc tr<TAB> -o yaml
#kubernetes #zsh #shell
I should really set up #zsh on my desktop at work. Find myself really missing a lot of the quality of life stuff I have set up at home.
Internally the registered completion function runs kubectl __complete with the same terms, like: `kubectl __complete get ns ku`, which emits a list of terms back to the completion function.
kubectl can be run with higher verbosity (eg -v6) to see the underlying requests being made to the remote server, but they're the normal ones to retrieve a list of resources (eg GET https://10.11.12.13:6443/api/v1/namespaces?limit=500).
#kubernetes #zsh #shell #completion
Relevant code in kubectl doing the completions: #kubernetes #zsh #shell #completion