Skip to content

Commit c93b0fb

Browse files
committed
[zh-cn]sync kubectl_expose/_index.md
Signed-off-by: xin.li <[email protected]>
1 parent 85ddc32 commit c93b0fb

File tree

1 file changed

+82
-56
lines changed
  • content/zh-cn/docs/reference/kubectl/generated/kubectl_expose

1 file changed

+82
-56
lines changed

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

Lines changed: 82 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,26 @@ kubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP]
4949

5050
<!--
5151
```
52-
# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000
53-
# Create a service for a replication controller identified by type and name specified in "nginx-controller.yaml", which serves on port 80 and connects to the containers on port 8000
54-
# Create a service for a pod valid-pod, which serves on port 444 with the name "frontend"
55-
# Create a second service based on the above service, exposing the container port 8443 as port 443 with the name "nginx-https"
56-
# Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.
57-
# Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000
58-
# Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000
52+
# Create a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000
53+
kubectl expose rc nginx --port=80 --target-port=8000
54+
55+
# Create a service for a replication controller identified by type and name specified in "nginx-controller.yaml", which serves on port 80 and connects to the containers on port 8000
56+
kubectl expose -f nginx-controller.yaml --port=80 --target-port=8000
57+
58+
# Create a service for a pod valid-pod, which serves on port 444 with the name "frontend"
59+
kubectl expose pod valid-pod --port=444 --name=frontend
60+
61+
# Create a second service based on the above service, exposing the container port 8443 as port 443 with the name "nginx-https"
62+
kubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https
63+
64+
# Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.
65+
kubectl expose rc streamer --port=4100 --protocol=UDP --name=video-stream
66+
67+
# Create a service for a replicated nginx using replica set, which serves on port 80 and connects to the containers on port 8000
68+
kubectl expose rs nginx --port=80 --target-port=8000
69+
70+
# Create a service for an nginx deployment, which serves on port 80 and connects to the containers on port 8000
71+
kubectl expose deployment nginx --port=80 --target-port=8000
5972
```
6073
-->
6174
```shell
@@ -84,7 +97,7 @@ kubectl expose deployment nginx --port=80 --target-port=8000
8497

8598
## {{% heading "options" %}}
8699

87-
<table style="width: 100%; table-layout: fixed;">
100+
<table style="width: 100%; table-layout: fixed;">
88101
<colgroup>
89102
<col span="1" style="width: 10px;" />
90103
<col span="1" />
@@ -95,7 +108,8 @@ kubectl expose deployment nginx --port=80 --target-port=8000
95108
<td colspan="2">--allow-missing-template-keys&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:true</td>
96109
</tr>
97110
<tr>
98-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
111+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
112+
<p>
99113
<!--
100114
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
101115
-->
@@ -108,7 +122,8 @@ If true, ignore any errors in templates when a field or map key is missing in th
108122
<td colspan="2">--cluster-ip string</td>
109123
</tr>
110124
<tr>
111-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
125+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
126+
<p>
112127
<!--
113128
ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to 'None' to create a headless service.
114129
-->
@@ -120,7 +135,8 @@ ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to
120135
<td colspan="2">--dry-run string[="unchanged"]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:"none"</td>
121136
</tr>
122137
<tr>
123-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
138+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
139+
<p>
124140
<!--
125141
Must be &quot;none&quot;, &quot;server&quot;, or &quot;client&quot;. If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource.
126142
-->
@@ -133,7 +149,8 @@ Must be &quot;none&quot;, &quot;server&quot;, or &quot;client&quot;. If client s
133149
<td colspan="2">--external-ip string</td>
134150
</tr>
135151
<tr>
136-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
152+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
153+
<p>
137154
<!--
138155
Additional external IP address (not managed by Kubernetes) to accept for the service. If this IP is routed to a node, the service can be accessed by this IP in addition to its generated service IP.
139156
-->
@@ -146,7 +163,8 @@ Additional external IP address (not managed by Kubernetes) to accept for the ser
146163
<td colspan="2">--field-manager string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:"kubectl-expose"</td>
147164
</tr>
148165
<tr>
149-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
166+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
167+
<p>
150168
<!--
151169
Name of the manager used to track field ownership.
152170
-->
@@ -158,7 +176,8 @@ Name of the manager used to track field ownership.
158176
<td colspan="2">-f, --filename strings</td>
159177
</tr>
160178
<tr>
161-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
179+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
180+
<p>
162181
<!--
163182
Filename, directory, or URL to files identifying the resource to expose a service
164183
-->
@@ -170,7 +189,8 @@ Filename, directory, or URL to files identifying the resource to expose a servic
170189
<td colspan="2">-h, --help</td>
171190
</tr>
172191
<tr>
173-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
192+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
193+
<p>
174194
<!--
175195
help for expose
176196
-->
@@ -182,7 +202,8 @@ expose 操作的帮助命令。
182202
<td colspan="2">-k, --kustomize string</td>
183203
</tr>
184204
<tr>
185-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
205+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
206+
<p>
186207
<!--
187208
Process the kustomization directory. This flag can't be used together with -f or -R.
188209
-->
@@ -194,7 +215,8 @@ Process the kustomization directory. This flag can't be used together with -f or
194215
<td colspan="2">-l, --labels string</td>
195216
</tr>
196217
<tr>
197-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
218+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
219+
<p>
198220
<!--
199221
Labels to apply to the service created by this call.
200222
-->
@@ -206,7 +228,8 @@ Labels to apply to the service created by this call.
206228
<td colspan="2">--load-balancer-ip string</td>
207229
</tr>
208230
<tr>
209-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
231+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
232+
<p>
210233
<!--
211234
IP to assign to the LoadBalancer. If empty, an ephemeral IP will be created and used (cloud-provider specific).
212235
-->
@@ -218,7 +241,8 @@ IP to assign to the LoadBalancer. If empty, an ephemeral IP will be created and
218241
<td colspan="2">--name string</td>
219242
</tr>
220243
<tr>
221-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
244+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
245+
<p>
222246
<!--
223247
The name for the newly created object.
224248
-->
@@ -230,7 +254,8 @@ The name for the newly created object.
230254
<td colspan="2">-o, --output string</td>
231255
</tr>
232256
<tr>
233-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
257+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
258+
<p>
234259
<!--
235260
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
236261
-->
@@ -243,7 +268,8 @@ json、yaml、name、go-template、go-template-file、template、templatefile、
243268
<td colspan="2">--override-type string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:"merge"</td>
244269
</tr>
245270
<tr>
246-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
271+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
272+
<p>
247273
<!--
248274
The method used to override the generated object: json, merge, or strategic.
249275
-->
@@ -255,7 +281,8 @@ The method used to override the generated object: json, merge, or strategic.
255281
<td colspan="2">--overrides string</td>
256282
</tr>
257283
<tr>
258-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
284+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
285+
<p>
259286
<!--
260287
An inline JSON override for the generated object. If this is non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field.
261288
-->
@@ -268,7 +295,8 @@ An inline JSON override for the generated object. If this is non-empty, it is us
268295
<td colspan="2">--port string</td>
269296
</tr>
270297
<tr>
271-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
298+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
299+
<p>
272300
<!--
273301
The port that the service should serve on. Copied from the resource being exposed, if unspecified
274302
-->
@@ -280,19 +308,21 @@ The port that the service should serve on. Copied from the resource being expose
280308
<td colspan="2">--protocol string</td>
281309
</tr>
282310
<tr>
283-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
311+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
312+
<p>
284313
<!--
285314
The network protocol for the service to be created. Default is 'TCP'.
286315
-->
287-
要创建的服务的网络协议。默认是 TCP
316+
要创建的服务的网络协议。默认是 'TCP'
288317
</p></td>
289318
</tr>
290319

291320
<tr>
292321
<td colspan="2">-R, --recursive</td>
293322
</tr>
294323
<tr>
295-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
324+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
325+
<p>
296326
<!--
297327
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
298328
-->
@@ -304,7 +334,8 @@ Process the directory used in -f, --filename recursively. Useful when you want t
304334
<td colspan="2">--save-config</td>
305335
</tr>
306336
<tr>
307-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
337+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
338+
<p>
308339
<!--
309340
If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
310341
-->
@@ -317,7 +348,8 @@ If true, the configuration of current object will be saved in its annotation. Ot
317348
<td colspan="2">--selector string</td>
318349
</tr>
319350
<tr>
320-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
351+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
352+
<p>
321353
<!--
322354
A label selector to use for this service. Only equality-based selector requirements are supported. If empty (the default) infer the selector from the replication controller or replica set.)
323355
-->
@@ -330,19 +362,21 @@ A label selector to use for this service. Only equality-based selector requireme
330362
<td colspan="2">--session-affinity string</td>
331363
</tr>
332364
<tr>
333-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
365+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
366+
<p>
334367
<!--
335368
If non-empty, set the session affinity for the service to this; legal values: 'None', 'ClientIP'
336369
-->
337-
如果非空,将服务的会话亲和性设置为此值;有效值为:None”、“ClientIP
370+
如果非空,将服务的会话亲和性设置为此值;有效值为:'None'、'ClientIP'
338371
</p></td>
339372
</tr>
340373

341374
<tr>
342375
<td colspan="2">--show-managed-fields</td>
343376
</tr>
344377
<tr>
345-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
378+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
379+
<p>
346380
<!--
347381
If true, keep the managedFields when printing objects in JSON or YAML format.
348382
-->
@@ -354,7 +388,8 @@ If true, keep the managedFields when printing objects in JSON or YAML format.
354388
<td colspan="2">--target-port string</td>
355389
</tr>
356390
<tr>
357-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
391+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
392+
<p>
358393
<!--
359394
Name or number for the port on the container that the service should direct traffic to. Optional.
360395
-->
@@ -507,30 +542,6 @@ The name of the kubeconfig context to use
507542
</p></td>
508543
</tr>
509544

510-
<tr>
511-
<td colspan="2">--default-not-ready-toleration-seconds int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:300</td>
512-
</tr>
513-
<tr>
514-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
515-
<!--
516-
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.
517-
-->
518-
设置针对 notReady:NoExecute 的容忍度的 tolerationSeconds,默认添加到所有尚未设置此容忍度的 Pod。
519-
</p></td>
520-
</tr>
521-
522-
<tr>
523-
<td colspan="2">--default-unreachable-toleration-seconds int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!--Default:-->默认值:300</td>
524-
</tr>
525-
<tr>
526-
<td></td><td style="line-height: 130%; word-wrap: break-word;"><p>
527-
<!--
528-
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.
529-
-->
530-
设置针对 unreachable:NoExecute 的容忍度的 tolerationSeconds,默认添加到所有尚未设置此容忍度的 Pod。
531-
</p></td>
532-
</tr>
533-
534545
<tr>
535546
<td colspan="2">--disable-compression</td>
536547
</tr>
@@ -567,6 +578,21 @@ CLI 请求要使用的 kubeconfig 文件的路径。
567578
</p></td>
568579
</tr>
569580

581+
<tr>
582+
<td colspan="2">--kuberc string</td>
583+
</tr>
584+
<tr>
585+
<td></td><td style="line-height: 130%; word-wrap: break-word;">
586+
<p>
587+
<!--
588+
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.
589+
-->
590+
用于偏好设置的 kuberc 文件的路径。可以通过导出 KUBECTL_KUBERC=false
591+
特性门控或关闭 KUBERC=off 特性来禁用此功能。
592+
</p>
593+
</td>
594+
</tr>
595+
570596
<tr>
571597
<td colspan="2">--match-server-version</td>
572598
</tr>

0 commit comments

Comments
 (0)