Skip to content

Commit 1bd8cf2

Browse files
committed
[zh] Add kuberc.v1beta1.md
1 parent 7f1ac74 commit 1bd8cf2

File tree

1 file changed

+315
-0
lines changed

1 file changed

+315
-0
lines changed
Lines changed: 315 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,315 @@
1+
---
2+
title: kuberc (v1beta1)
3+
content_type: tool-reference
4+
package: kubectl.config.k8s.io/v1beta1
5+
---
6+
<!--
7+
title: kuberc (v1beta1)
8+
content_type: tool-reference
9+
package: kubectl.config.k8s.io/v1beta1
10+
auto_generated: true
11+
-->
12+
13+
<!--
14+
## Resource Types
15+
-->
16+
## 资源类型 {#resource-types}
17+
18+
- [Preference](#kubectl-config-k8s-io-v1beta1-Preference)
19+
20+
## `Preference` {#kubectl-config-k8s-io-v1beta1-Preference}
21+
22+
<p>
23+
<!--
24+
Preference stores elements of KubeRC configuration file
25+
-->
26+
<code>Preference</code> 存储 KubeRC 配置文件的元素。
27+
</p>
28+
29+
<table class="table">
30+
<thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
31+
<tbody>
32+
33+
<tr><td><code>apiVersion</code><br/>string</td><td><code>kubectl.config.k8s.io/v1beta1</code></td></tr>
34+
<tr><td><code>kind</code><br/>string</td><td><code>Preference</code></td></tr>
35+
36+
<tr><td><code>defaults</code> <B><!--[Required]-->[必需]</B><br/>
37+
<a href="#kubectl-config-k8s-io-v1beta1-CommandDefaults"><code>[]CommandDefaults</code></a>
38+
</td>
39+
<td>
40+
<p>
41+
<!--
42+
defaults allow changing default option values of commands.
43+
This is especially useful, when user doesn't want to explicitly
44+
set options each time.
45+
-->
46+
<code>defaults</code> 允许更改命令的默认选项值。
47+
这对于用户不想每次明确设置选项时特别有用。
48+
</p>
49+
</td>
50+
</tr>
51+
<tr><td><code>aliases</code> <B><!--[Required]-->[必需]</B><br/>
52+
<a href="#kubectl-config-k8s-io-v1beta1-AliasOverride"><code>[]AliasOverride</code></a>
53+
</td>
54+
<td>
55+
<p>
56+
<!--
57+
aliases allow defining command aliases for existing kubectl commands, with optional default option values.
58+
If the alias name collides with a built-in command, built-in command always takes precedence.
59+
Option overrides defined in the defaults section do NOT apply to aliases for the same command.
60+
kubectl [ALIAS NAME] [USER_OPTIONS] [USER_EXPLICIT_ARGS] expands to
61+
kubectl [COMMAND] # built-in command alias points to
62+
[KUBERC_PREPEND_ARGS]
63+
[USER_OPTIONS]
64+
[KUBERC_OPTIONS] # rest of the options that are not passed by user in [USER_OPTIONS]
65+
[USER_EXPLICIT_ARGS]
66+
[KUBERC_APPEND_ARGS]
67+
e.g.
68+
-->
69+
<code>aliases</code> 允许为现有的 kubectl 命令定义命令别名,并可选择设置默认选项值。
70+
如果别名与内置命令冲突,内置命令始终优先。
71+
在 <code>defaults</code> 部分定义的选项 <code>overrides</code> 不适用于同一命令的别名。
72+
<code>kubectl [ALIAS NAME] [USER_OPTIONS] [USER_EXPLICIT_ARGS]</code> 展开为:
73+
74+
```bash
75+
kubectl [COMMAND] # 别名指向的内置命令
76+
[KUBERC_PREPEND_ARGS]
77+
[USER_OPTIONS]
78+
[KUBERC_OPTIONS] # 其余未由用户在 [用户选项] 中传递的选项
79+
[USER_EXPLICIT_ARGS]
80+
[KUBERC_APPEND_ARGS]
81+
82+
```
83+
84+
例如:
85+
86+
```yaml
87+
- name: runx
88+
command: run
89+
options:
90+
- name: image
91+
default: nginx
92+
appendArgs:
93+
- --
94+
- custom-arg1
95+
```
96+
97+
<!--
98+
For example, if user invokes &quot;kubectl runx test-pod&quot; command,
99+
this will be expanded to &quot;kubectl run --image=nginx test-pod -- custom-arg1&quot;
100+
-->
101+
例如,如果用户调用 <code>&quot;kubectl runx test-pod&quot;</code> 命令,
102+
这将被展开为 <code>&quot;kubectl run --image=nginx test-pod -- custom-arg1&quot;</code>
103+
104+
```yaml
105+
- name: getn
106+
command: get
107+
options:
108+
- name: output
109+
default: wide
110+
prependArgs:
111+
- node
112+
```
113+
114+
<!--
115+
&quot;kubectl getn control-plane-1&quot; expands to &quot;kubectl get node control-plane-1 --output=wide&quot;
116+
&quot;kubectl getn control-plane-1 --output=json&quot; expands to &quot;kubectl get node --output=json control-plane-1&quot;
117+
-->
118+
<li><code>&quot;kubectl getn control-plane-1&quot; 扩展为 &quot;kubectl get node control-plane-1 --output=wide&quot;</code></li>
119+
<li><code>&quot;kubectl getn control-plane-1 --output=json&quot; 扩展为 &quot;kubectl get node --output=json control-plane-1&quot;</code></li>
120+
</td>
121+
</tr>
122+
</tbody>
123+
</table>
124+
125+
## `AliasOverride` {#kubectl-config-k8s-io-v1beta1-AliasOverride}
126+
127+
<!--
128+
**Appears in:**
129+
-->
130+
**出现在:**
131+
132+
- [Preference](#kubectl-config-k8s-io-v1beta1-Preference)
133+
134+
<p>
135+
<!--
136+
AliasOverride stores the alias definitions.
137+
-->
138+
<code>AliasOverride</code> 存储别名定义。
139+
</p>
140+
141+
<table class="table">
142+
<thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
143+
<tbody>
144+
145+
<tr><td><code>name</code> <B><!--[Required]-->[必需]</B><br/>
146+
<code>string</code>
147+
</td>
148+
<td>
149+
<p>
150+
<!--
151+
name is the name of alias that can only include alphabetical characters
152+
If the alias name conflicts with the built-in command,
153+
built-in command will be used.
154+
-->
155+
<code>name</code> 是别名的名称,只能包含字母字符。如果别名与内置命令冲突,
156+
将使用内置命令。
157+
</p>
158+
</td>
159+
</tr>
160+
<tr><td><code>command</code> <B><!--[Required]-->[必需]</B><br/>
161+
<code>string</code>
162+
</td>
163+
<td>
164+
<p>
165+
<!--
166+
command is the single or set of commands to execute, such as &quot;set env&quot; or &quot;create&quot;
167+
-->
168+
<code>command</code> 是要执行的单个或一组命令,例如 &quot;set env&quot; 或 &quot;create&quot;
169+
</p>
170+
</td>
171+
</tr>
172+
<tr><td><code>prependArgs</code> <B><!--[Required]-->[必需]</B><br/>
173+
<code>[]string</code>
174+
</td>
175+
<td>
176+
<p>
177+
<!--
178+
prependArgs stores the arguments such as resource names, etc.
179+
These arguments are inserted after the alias name.
180+
-->
181+
<code>prependArgs</code> 存储如资源名称等参数。
182+
这些参数插入到别名名称之后。
183+
</p>
184+
</td>
185+
</tr>
186+
<tr><td><code>appendArgs</code> <B><!--[Required]-->[必需]</B><br/>
187+
<code>[]string</code>
188+
</td>
189+
<td>
190+
<p>
191+
<!--
192+
appendArgs stores the arguments such as resource names, etc.
193+
These arguments are appended to the USER_ARGS.
194+
-->
195+
<code>appendArgs</code> 存储如资源名称等参数。
196+
这些参数附加到 USER_ARGS 中。
197+
</p>
198+
</td>
199+
</tr>
200+
<tr><td><code>options</code> <B><!--[Required]-->[必需]</B><br/>
201+
<a href="#kubectl-config-k8s-io-v1beta1-CommandOptionDefault"><code>[]CommandOptionDefault</code></a>
202+
</td>
203+
<td>
204+
<p>
205+
<!--
206+
options is allocated to store the option definitions of alias.
207+
options only modify the default value of the option and if
208+
user explicitly passes a value, explicit one is used.
209+
-->
210+
<code>options</code> 用于存储别名的选项定义。
211+
<code>options</code> 只修改选项的默认值,如果用户显式传递一个值,则使用显式值。
212+
</p>
213+
</td>
214+
</tr>
215+
</tbody>
216+
</table>
217+
218+
## `CommandDefaults` {#kubectl-config-k8s-io-v1beta1-CommandDefaults}
219+
220+
<!--
221+
**Appears in:**
222+
-->
223+
**出现在:**
224+
225+
- [Preference](#kubectl-config-k8s-io-v1beta1-Preference)
226+
227+
<p>
228+
<!--
229+
CommandDefaults stores the commands and their associated option's
230+
default values.
231+
-->
232+
<code>CommandDefaults</code> 存储命令及其关联参数的默认值。
233+
</p>
234+
235+
<table class="table">
236+
<thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
237+
<tbody>
238+
239+
<tr><td><code>command</code> <B><!--[Required]-->[必需]</B><br/>
240+
<code>string</code>
241+
</td>
242+
<td>
243+
<p>
244+
<!--
245+
command refers to a command whose option's default value is changed.
246+
-->
247+
<code>command</code> 指向一个命令,其选项的默认值已更改。
248+
</p>
249+
</td>
250+
</tr>
251+
<tr><td><code>options</code> <B><!--[Required]-->[必需]</B><br/>
252+
<a href="#kubectl-config-k8s-io-v1beta1-CommandDefaults"><code>[]CommandDefaults</code></a>
253+
</td>
254+
<td>
255+
<p>
256+
<!--
257+
options is a list of options storing different default values.
258+
-->
259+
<code>options</code> 是一个选项的列表,存储不同的默认值。
260+
</p>
261+
</td>
262+
</tr>
263+
</tbody>
264+
</table>
265+
266+
## `CommandOptionDefault` {#kubectl-config-k8s-io-v1beta1-CommandOptionDefault}
267+
268+
<!--
269+
**Appears in:**
270+
-->
271+
**出现在:**
272+
273+
- [AliasOverride](#kubectl-config-k8s-io-v1beta1-AliasOverride)
274+
275+
- [CommandDefaults](#kubectl-config-k8s-io-v1beta1-CommandDefaults)
276+
277+
<p>
278+
<!--
279+
CommandOptionDefault stores the name and the specified default
280+
value of an option.
281+
-->
282+
<code>CommandOptionDefault</code> 存储参数的名称和指定的默认值。
283+
</p>
284+
285+
<table class="table">
286+
<thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
287+
<tbody>
288+
289+
<tr><td><code>name</code> <B><!--[Required]-->[必需]</B><br/>
290+
<code>string</code>
291+
</td>
292+
<td>
293+
<p>
294+
<!--
295+
Option name (long form, without dashes).
296+
-->
297+
<code>option</code> 名称(长形式,不带破折号)。
298+
</p>
299+
</td>
300+
</tr>
301+
<tr><td><code>default</code> <B><!--[Required]-->[必需]</B><br/>
302+
<code>string</code>
303+
</td>
304+
<td>
305+
<p>
306+
<!--
307+
In a string format of a default value. It will be parsed
308+
by kubectl to the compatible value of the option.
309+
-->
310+
在默认值的字符串格式中。它将被 kubectl 解析为选项的兼容值。
311+
</p>
312+
</td>
313+
</tr>
314+
</tbody>
315+
</table>

0 commit comments

Comments
 (0)