mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-07 04:03:20 +00:00
Allow kubectl expose
to be polymorphic to the source of the selector
Allows exposing new resource types to be exposed (OpenShift deployment controllers, copying services, and other resources that will have pod label selectors). Also fixed a bug where the selector wasn't exposed because of parameter defaulting.
This commit is contained in:
@@ -7,11 +7,11 @@ Take a replicated application and expose it as Kubernetes Service
|
||||
|
||||
Take a replicated application and expose it as Kubernetes Service.
|
||||
|
||||
Looks up a ReplicationController by name, and uses the selector for that replication controller
|
||||
as the selector for a new Service on the specified port.
|
||||
Looks up a replication controller or service by name and uses the selector for that resource as the
|
||||
selector for a new Service on the specified port.
|
||||
|
||||
```
|
||||
kubectl expose NAME --port=port [--protocol=TCP|UDP] [--container-port=number-or-name] [--service-name=name] [--public-ip=ip] [--create-external-load-balancer=bool]
|
||||
kubectl expose RESOURCE NAME --port=port [--protocol=TCP|UDP] [--container-port=number-or-name] [--service-name=name] [--public-ip=ip] [--create-external-load-balancer=bool]
|
||||
```
|
||||
|
||||
### Examples
|
||||
@@ -20,6 +20,9 @@ kubectl expose NAME --port=port [--protocol=TCP|UDP] [--container-port=number-or
|
||||
// Creates a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.
|
||||
$ kubectl expose nginx --port=80 --container-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 --container-port=8443 --service-name=nginx-https
|
||||
|
||||
// Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video-stream'.
|
||||
$ kubectl expose streamer --port=4100 --protocol=udp --service-name=video-stream
|
||||
```
|
||||
|
@@ -16,8 +16,8 @@ kubectl expose \- Take a replicated application and expose it as Kubernetes Serv
|
||||
Take a replicated application and expose it as Kubernetes Service.
|
||||
|
||||
.PP
|
||||
Looks up a ReplicationController by name, and uses the selector for that replication controller
|
||||
as the selector for a new Service on the specified port.
|
||||
Looks up a replication controller or service by name and uses the selector for that resource as the
|
||||
selector for a new Service on the specified port.
|
||||
|
||||
|
||||
.SH OPTIONS
|
||||
@@ -197,6 +197,9 @@ as the selector for a new Service on the specified port.
|
||||
// Creates a service for a replicated nginx, which serves on port 80 and connects to the containers on port 8000.
|
||||
$ kubectl expose nginx \-\-port=80 \-\-container\-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 \-\-container\-port=8443 \-\-service\-name=nginx\-https
|
||||
|
||||
// Create a service for a replicated streaming application on port 4100 balancing UDP traffic and named 'video\-stream'.
|
||||
$ kubectl expose streamer \-\-port=4100 \-\-protocol=udp \-\-service\-name=video\-stream
|
||||
|
||||
|
Reference in New Issue
Block a user