Kubernetes:55.kubeadm completion(自動補完)

1545 ワード

構文
[09:06:48 root@ceshi-01 ~ $]kubeadm completion --help

Output shell completion code for the specified shell (bash or zsh).
    (bash or zsh)
The shell code must be evaluated to provide interactive completion of kubeadm commands. 
    shell     kubeadm        。
This can be done by sourcing it from the .bash_profile.
      .bash_profile     。

Note: this requires the bash-completion framework.

To install it on Mac use homebrew:
    $ brew install bash-completion
Once installed, bash_completion must be evaluated. This can be done by adding the
following line to the .bash_profile
    $ source $(brew --prefix)/etc/bash_completion

If bash-completion is not installed on Linux, please install the 'bash-completion' package
via your distribution's package manager.

Note for zsh users: [1] zsh completions are only supported in versions of zsh >= 5.2

Usage:
  kubeadm completion SHELL [flags]

Examples:

# Install bash completion on a Mac using homebrew
brew install bash-completion
printf "
# Bash completion support
source $(brew --prefix)/etc/bash_completion
" >> $HOME/.bash_profile source $HOME/.bash_profile # Load the kubeadm completion code for bash into the current shell source ~/.kube/kubeadm_completion.bash.inc printf "
# Kubeadm shell completion
source '$HOME/.kube/kubeadm_completion.bash.inc'
" >> $HOME/.bash_profile source $HOME/.bash_profile # Load the kubeadm completion code for zsh[1] into the current shell source