Skip to content

Commit ae635ef

Browse files
authored
Merge pull request #52529 from my-git9/npe-21738
[zh-cn]sync kubectl_completion/_index.md
2 parents 44660dd + a8a6779 commit ae635ef

File tree

1 file changed

+61
-70
lines changed
  • content/zh-cn/docs/reference/kubectl/generated/kubectl_completion

1 file changed

+61
-70
lines changed

content/zh-cn/docs/reference/kubectl/generated/kubectl_completion/_index.md

Lines changed: 61 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -103,52 +103,52 @@ kubectl completion SHELL
103103
kubectl completion powershell >> $PROFILE
104104
```
105105
-->
106-
```
107-
# 使用 homebrew 在 macOS 上安装 bash-completion
108-
## 如果运行 macOS 附带的 Bash 3.2
109-
brew install bash-completion
110-
## 或者,如果运行的是 Bash 4.1+
111-
brew install bash-completion@2
112-
## 如果通过 homebrew 安装了 kubectl,Shell 补全应该能够立即起作用
113-
## 如果你通过其他方式安装,则可能需要将新的补全数据添加到补全目录中
114-
kubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl
115-
116-
117-
# 在 Linux 上安装 bash 补全
118-
## 如果 Linux 上未安装 bash-completion,请通过发行版的包管理器安装 "bash-completion" 包。
119-
## 将 bash 的 kubectl 补全代码加载到当前 shell 中
120-
source <(kubectl completion bash)
121-
## 将 bash 补全代码写入文件并从 .bash_profile 中引用之
122-
kubectl completion bash > ~/.kube/completion.bash.inc
123-
printf "
124-
# kubectl shell completion
125-
source '$HOME/.kube/completion.bash.inc'
126-
" >> $HOME/.bash_profile
127-
source $HOME/.bash_profile
128-
129-
# 将 zsh[1] 的 kubectl 补全代码加载到当前 shell 中
130-
source <(kubectl completion zsh)
131-
# 将 zsh[1] 的 kubectl 补全代码设置为在启动时自动加载
132-
kubectl completion zsh > "${fpath[1]}/_kubectl"
133-
134-
135-
# 将 fish[2] 的 kubectl 补全代码加载到当前 shell 中
136-
kubectl completion fish | source
137-
# 要为每个会话都加载补全代码,请执行一次如下命令:
138-
kubectl completion fish > ~/.config/fish/completions/kubectl.fish
139-
140-
# 将 powershell 的 kubectl 补全代码加载到当前 shell 中
141-
kubectl completion powershell | Out-String | Invoke-Expression
142-
# 设置 powershell 的 kubectl 补全代码在启动时运行
143-
## 将补全代码保存到脚本并在配置文件中执行
144-
kubectl completion powershell > $HOME\.kube\completion.ps1
145-
Add-Content $PROFILE "$HOME\.kube\completion.ps1"
146-
## 执行配置文件中的补全代码
147-
Add-Content $PROFILE "if (Get-Command kubectl -ErrorAction SilentlyContinue) {
148-
kubectl completion powershell | Out-String | Invoke-Expression
149-
}"
150-
## 直接将补全代码添加到 $PROFILE 脚本
151-
kubectl completion powershell >> $PROFILE
106+
```shell
107+
# 使用 homebrew 在 macOS 上安装 bash-completion
108+
## 如果运行 macOS 附带的 Bash 3.2
109+
brew install bash-completion
110+
## 或者,如果运行的是 Bash 4.1+
111+
brew install bash-completion@2
112+
## 如果通过 homebrew 安装了 kubectl,Shell 补全应该能够立即起作用
113+
## 如果你通过其他方式安装,则可能需要将新的补全数据添加到补全目录中
114+
kubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl
115+
116+
117+
# 在 Linux 上安装 bash 补全
118+
## 如果 Linux 上未安装 bash-completion,请通过发行版的包管理器安装 "bash-completion" 包。
119+
## 将 bash 的 kubectl 补全代码加载到当前 shell 中
120+
source <(kubectl completion bash)
121+
## 将 bash 补全代码写入文件并从 .bash_profile 中引用之
122+
kubectl completion bash > ~/.kube/completion.bash.inc
123+
printf "
124+
# kubectl shell completion
125+
source '$HOME/.kube/completion.bash.inc'
126+
" >> $HOME/.bash_profile
127+
source $HOME/.bash_profile
128+
129+
# 将 zsh[1] 的 kubectl 补全代码加载到当前 shell 中
130+
source <(kubectl completion zsh)
131+
# 将 zsh[1] 的 kubectl 补全代码设置为在启动时自动加载
132+
kubectl completion zsh > "${fpath[1]}/_kubectl"
133+
134+
135+
# 将 fish[2] 的 kubectl 补全代码加载到当前 shell 中
136+
kubectl completion fish | source
137+
# 要为每个会话都加载补全代码,请执行一次如下命令:
138+
kubectl completion fish > ~/.config/fish/completions/kubectl.fish
139+
140+
# 将 powershell 的 kubectl 补全代码加载到当前 shell 中
141+
kubectl completion powershell | Out-String | Invoke-Expression
142+
# 设置 powershell 的 kubectl 补全代码在启动时运行
143+
## 将补全代码保存到脚本并在配置文件中执行
144+
kubectl completion powershell > $HOME\.kube\completion.ps1
145+
Add-Content $PROFILE "$HOME\.kube\completion.ps1"
146+
## 执行配置文件中的补全代码
147+
Add-Content $PROFILE "if (Get-Command kubectl -ErrorAction SilentlyContinue) {
148+
kubectl completion powershell | Out-String | Invoke-Expression
149+
}"
150+
## 直接将补全代码添加到 $PROFILE 脚本
151+
kubectl completion powershell >> $PROFILE
152152
```
153153

154154
## {{% heading "options" %}}
@@ -296,30 +296,6 @@ The name of the kubeconfig context to use
296296
</p></td>
297297
</tr>
298298

299-
<tr>
300-
<td colspan="2">--default-not-ready-toleration-seconds int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: 300-->默认值:300</td>
301-
</tr>
302-
<tr>
303-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
304-
<!--
305-
Indicates the tolerationSeconds of the toleration for notReady:NoExecute that is added by default to every pod that does not already have such a toleration.
306-
-->
307-
设置针对 notReady:NoExecute 的容忍度的 tolerationSeconds,默认添加到所有尚未设置此容忍度的 Pod。
308-
</p></td>
309-
</tr>
310-
311-
<tr>
312-
<td colspan="2">--default-unreachable-toleration-seconds int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default: 300-->默认值:300</td>
313-
</tr>
314-
<tr>
315-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
316-
<!--
317-
Indicates the tolerationSeconds of the toleration for unreachable:NoExecute that is added by default to every pod that does not already have such a toleration.
318-
-->
319-
设置针对 unreachable:NoExecute 的容忍度的 tolerationSeconds,默认添加到所有尚未设置此容忍度的 Pod。
320-
</p></td>
321-
</tr>
322-
323299
<tr>
324300
<td colspan="2">--disable-compression</td>
325301
</tr>
@@ -356,6 +332,21 @@ CLI 请求要使用的 kubeconfig 文件的路径。
356332
</p></td>
357333
</tr>
358334

335+
<tr>
336+
<td colspan="2">--kuberc string</td>
337+
</tr>
338+
<tr>
339+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
340+
<p>
341+
<!--
342+
Path to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.
343+
-->
344+
用于偏好设置的 kuberc 文件的路径。可以通过导出 KUBECTL_KUBERC=false
345+
特性门控或关闭 KUBERC=off 特性门控来禁用此功能。
346+
</p>
347+
</td>
348+
</tr>
349+
359350
<tr>
360351
<td colspan="2">--match-server-version</td>
361352
</tr>

0 commit comments

Comments
 (0)