mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 05:01:46 +00:00
expose: Use resource builder
Plus: * Rename flag --service-name to --name * Some refactoring
This commit is contained in:
@@ -12,7 +12,7 @@ selector for a new Service on the specified port. If no labels are specified, th
|
||||
re-use the labels from the resource it exposes.
|
||||
|
||||
```
|
||||
kubectl expose RESOURCE NAME --port=port [--protocol=TCP|UDP] [--target-port=number-or-name] [--service-name=name] [--public-ip=ip] [--create-external-load-balancer=bool]
|
||||
kubectl expose RESOURCE NAME --port=port [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--public-ip=ip] [--create-external-load-balancer=bool]
|
||||
```
|
||||
|
||||
### Examples
|
||||
@@ -22,10 +22,10 @@ kubectl expose RESOURCE NAME --port=port [--protocol=TCP|UDP] [--target-port=num
|
||||
$ kubectl expose rc nginx --port=80 --target-port=8000
|
||||
|
||||
// Creates a second service based on the above service, exposing the container port 8443 as port 443 with the name "nginx-https"
|
||||
$ kubectl expose service nginx --port=443 --target-port=8443 --service-name=nginx-https
|
||||
$ kubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https
|
||||
|
||||
// Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.
|
||||
$ kubectl expose rc streamer --port=4100 --protocol=udp --service-name=video-stream
|
||||
$ kubectl expose rc streamer --port=4100 --protocol=udp --name=video-stream
|
||||
```
|
||||
|
||||
### Options
|
||||
@@ -37,6 +37,7 @@ $ kubectl expose rc streamer --port=4100 --protocol=udp --service-name=video-str
|
||||
--generator="service/v1": The name of the API generator to use. Default is 'service/v1'.
|
||||
-h, --help=false: help for expose
|
||||
-l, --labels="": Labels to apply to the service created by this call.
|
||||
--name="": The name for the newly created service.
|
||||
--no-headers=false: When using the default output, don't print headers.
|
||||
-o, --output="": Output format. One of: json|yaml|template|templatefile.
|
||||
--output-version="": Output the formatted object with the given version (default api-version).
|
||||
@@ -45,7 +46,6 @@ $ kubectl expose rc streamer --port=4100 --protocol=udp --service-name=video-str
|
||||
--protocol="TCP": The network protocol for the service to be created. Default is 'tcp'.
|
||||
--public-ip="": Name of a public IP address to set for the service. The service will be assigned this IP in addition to its generated service IP.
|
||||
--selector="": A label selector to use for this service. If empty (the default) infer the selector from the replication controller.
|
||||
--service-name="": The name for the newly created service.
|
||||
--target-port="": Name or number for the port on the container that the service should direct traffic to. Optional.
|
||||
-t, --template="": Template string or path to template file to use when -o=template or -o=templatefile. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]
|
||||
```
|
||||
@@ -82,6 +82,6 @@ $ kubectl expose rc streamer --port=4100 --protocol=udp --service-name=video-str
|
||||
### SEE ALSO
|
||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||
|
||||
###### Auto generated by spf13/cobra at 2015-05-15 00:05:04.553214179 +0000 UTC
|
||||
###### Auto generated by spf13/cobra at 2015-05-19 14:12:47.467953048 +0000 UTC
|
||||
|
||||
[]()
|
||||
|
Reference in New Issue
Block a user