kubectl completion
Generate shell completion code for
kubectlcommands. More information: https://kubernetes.io/docs/reference/kubectl/generated/kubectl_completion/.
- Print the completion script for Bash, Zsh, fish, or PowerShell:
kubectl completion
- Load Bash or Zsh completions into the current shell session:
source <(kubectl completion )
- Append Bash completion script to
~/.bashrc:
kubectl completion bash >>~/.bashrc
- Write Zsh completion script to a file in the
fpath:
kubectl completion zsh >"${fpath[1]}/_kubectl"
- Load fish completions into the current shell session:
kubectl completion fish | source
- Persist fish completions:
kubectl completion fish >~/.config/fish/completions/kubectl.fish
- Load PowerShell completions into the current shell session:
kubectl completion powershell | Out-String | Invoke-Expression
- Persist PowerShell completions:
kubectl completion powershell >>$PROFILE
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
