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