@@ -49,13 +49,26 @@ kubectl expose (-f FILENAME | TYPE NAME) [--port=port] [--protocol=TCP|UDP|SCTP]
49
49
50
50
<!--
51
51
```
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
59
72
```
60
73
-->
61
74
``` shell
@@ -84,7 +97,7 @@ kubectl expose deployment nginx --port=80 --target-port=8000
84
97
85
98
## {{% heading "options" %}}
86
99
87
- <table style =" width : 100% ; table-layout : fixed ;" >
100
+ <table style =" width : 100% ; table-layout : fixed ;" >
88
101
<colgroup >
89
102
<col span =" 1 " style =" width : 10px ;" />
90
103
<col span =" 1 " />
@@ -95,7 +108,8 @@ kubectl expose deployment nginx --port=80 --target-port=8000
95
108
<td colspan =" 2 " >--allow-missing-template-keys  ;  ;  ;  ;  ; <!-- Default:--> 默认值:true</td >
96
109
</tr >
97
110
<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 >
99
113
<!--
100
114
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.
101
115
-->
@@ -108,7 +122,8 @@ If true, ignore any errors in templates when a field or map key is missing in th
108
122
<td colspan =" 2 " >--cluster-ip string</td >
109
123
</tr >
110
124
<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 >
112
127
<!--
113
128
ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to 'None' to create a headless service.
114
129
-->
@@ -120,7 +135,8 @@ ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to
120
135
<td colspan =" 2 " >--dry-run string[="unchanged"]  ;  ;  ;  ;  ; <!-- Default:--> 默认值:"none"</td >
121
136
</tr >
122
137
<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 >
124
140
<!--
125
141
Must be "none", "server", or "client". 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.
126
142
-->
@@ -133,7 +149,8 @@ Must be "none", "server", or "client". If client s
133
149
<td colspan =" 2 " >--external-ip string</td >
134
150
</tr >
135
151
<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 >
137
154
<!--
138
155
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.
139
156
-->
@@ -146,7 +163,8 @@ Additional external IP address (not managed by Kubernetes) to accept for the ser
146
163
<td colspan =" 2 " >--field-manager string  ;  ;  ;  ;  ; <!-- Default:--> 默认值:"kubectl-expose"</td >
147
164
</tr >
148
165
<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 >
150
168
<!--
151
169
Name of the manager used to track field ownership.
152
170
-->
@@ -158,7 +176,8 @@ Name of the manager used to track field ownership.
158
176
<td colspan =" 2 " >-f, --filename strings</td >
159
177
</tr >
160
178
<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 >
162
181
<!--
163
182
Filename, directory, or URL to files identifying the resource to expose a service
164
183
-->
@@ -170,7 +189,8 @@ Filename, directory, or URL to files identifying the resource to expose a servic
170
189
<td colspan =" 2 " >-h, --help</td >
171
190
</tr >
172
191
<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 >
174
194
<!--
175
195
help for expose
176
196
-->
@@ -182,7 +202,8 @@ expose 操作的帮助命令。
182
202
<td colspan =" 2 " >-k, --kustomize string</td >
183
203
</tr >
184
204
<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 >
186
207
<!--
187
208
Process the kustomization directory. This flag can't be used together with -f or -R.
188
209
-->
@@ -194,7 +215,8 @@ Process the kustomization directory. This flag can't be used together with -f or
194
215
<td colspan =" 2 " >-l, --labels string</td >
195
216
</tr >
196
217
<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 >
198
220
<!--
199
221
Labels to apply to the service created by this call.
200
222
-->
@@ -206,7 +228,8 @@ Labels to apply to the service created by this call.
206
228
<td colspan =" 2 " >--load-balancer-ip string</td >
207
229
</tr >
208
230
<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 >
210
233
<!--
211
234
IP to assign to the LoadBalancer. If empty, an ephemeral IP will be created and used (cloud-provider specific).
212
235
-->
@@ -218,7 +241,8 @@ IP to assign to the LoadBalancer. If empty, an ephemeral IP will be created and
218
241
<td colspan =" 2 " >--name string</td >
219
242
</tr >
220
243
<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 >
222
246
<!--
223
247
The name for the newly created object.
224
248
-->
@@ -230,7 +254,8 @@ The name for the newly created object.
230
254
<td colspan =" 2 " >-o, --output string</td >
231
255
</tr >
232
256
<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 >
234
259
<!--
235
260
Output format. One of: (json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
236
261
-->
@@ -243,7 +268,8 @@ json、yaml、name、go-template、go-template-file、template、templatefile、
243
268
<td colspan =" 2 " >--override-type string  ;  ;  ;  ;  ; <!-- Default:--> 默认值:"merge"</td >
244
269
</tr >
245
270
<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 >
247
273
<!--
248
274
The method used to override the generated object: json, merge, or strategic.
249
275
-->
@@ -255,7 +281,8 @@ The method used to override the generated object: json, merge, or strategic.
255
281
<td colspan =" 2 " >--overrides string</td >
256
282
</tr >
257
283
<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 >
259
286
<!--
260
287
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.
261
288
-->
@@ -268,7 +295,8 @@ An inline JSON override for the generated object. If this is non-empty, it is us
268
295
<td colspan =" 2 " >--port string</td >
269
296
</tr >
270
297
<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 >
272
300
<!--
273
301
The port that the service should serve on. Copied from the resource being exposed, if unspecified
274
302
-->
@@ -280,19 +308,21 @@ The port that the service should serve on. Copied from the resource being expose
280
308
<td colspan =" 2 " >--protocol string</td >
281
309
</tr >
282
310
<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 >
284
313
<!--
285
314
The network protocol for the service to be created. Default is 'TCP'.
286
315
-->
287
- 要创建的服务的网络协议。默认是 “ TCP” 。
316
+ 要创建的服务的网络协议。默认是 ' TCP' 。
288
317
</p ></td >
289
318
</tr >
290
319
291
320
<tr >
292
321
<td colspan =" 2 " >-R, --recursive</td >
293
322
</tr >
294
323
<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 >
296
326
<!--
297
327
Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.
298
328
-->
@@ -304,7 +334,8 @@ Process the directory used in -f, --filename recursively. Useful when you want t
304
334
<td colspan =" 2 " >--save-config</td >
305
335
</tr >
306
336
<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 >
308
339
<!--
309
340
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.
310
341
-->
@@ -317,7 +348,8 @@ If true, the configuration of current object will be saved in its annotation. Ot
317
348
<td colspan =" 2 " >--selector string</td >
318
349
</tr >
319
350
<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 >
321
353
<!--
322
354
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.)
323
355
-->
@@ -330,19 +362,21 @@ A label selector to use for this service. Only equality-based selector requireme
330
362
<td colspan =" 2 " >--session-affinity string</td >
331
363
</tr >
332
364
<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 >
334
367
<!--
335
368
If non-empty, set the session affinity for the service to this; legal values: 'None', 'ClientIP'
336
369
-->
337
- 如果非空,将服务的会话亲和性设置为此值;有效值为:“ None”、“ ClientIP” 。
370
+ 如果非空,将服务的会话亲和性设置为此值;有效值为:' None'、' ClientIP' 。
338
371
</p ></td >
339
372
</tr >
340
373
341
374
<tr >
342
375
<td colspan =" 2 " >--show-managed-fields</td >
343
376
</tr >
344
377
<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 >
346
380
<!--
347
381
If true, keep the managedFields when printing objects in JSON or YAML format.
348
382
-->
@@ -354,7 +388,8 @@ If true, keep the managedFields when printing objects in JSON or YAML format.
354
388
<td colspan =" 2 " >--target-port string</td >
355
389
</tr >
356
390
<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 >
358
393
<!--
359
394
Name or number for the port on the container that the service should direct traffic to. Optional.
360
395
-->
@@ -507,30 +542,6 @@ The name of the kubeconfig context to use
507
542
</p ></td >
508
543
</tr >
509
544
510
- <tr >
511
- <td colspan =" 2 " >--default-not-ready-toleration-seconds int  ;  ;  ;  ;  ; <!-- 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  ;  ;  ;  ;  ; <!-- 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
-
534
545
<tr >
535
546
<td colspan =" 2 " >--disable-compression</td >
536
547
</tr >
@@ -567,6 +578,21 @@ CLI 请求要使用的 kubeconfig 文件的路径。
567
578
</p ></td >
568
579
</tr >
569
580
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
+
570
596
<tr >
571
597
<td colspan =" 2 " >--match-server-version</td >
572
598
</tr >
0 commit comments