mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-06 11:42:14 +00:00
Merge pull request #6034 from thockin/target_port_flag
Alias --container-port to --target-port in kubectl
This commit is contained in:
@@ -33,10 +33,10 @@ Looks up a replication controller or service by name and uses the selector for t
|
||||
selector for a new Service on the specified port.`
|
||||
|
||||
expose_example = `// 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
|
||||
$ kubectl expose 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 --container-port=8443 --service-name=nginx-https
|
||||
$ kubectl expose service nginx --port=443 --target-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`
|
||||
@@ -44,7 +44,7 @@ $ kubectl expose streamer --port=4100 --protocol=udp --service-name=video-stream
|
||||
|
||||
func (f *Factory) NewCmdExposeService(out io.Writer) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "expose RESOURCE NAME --port=port [--protocol=TCP|UDP] [--container-port=number-or-name] [--service-name=name] [--public-ip=ip] [--create-external-load-balancer=bool]",
|
||||
Use: "expose RESOURCE NAME --port=port [--protocol=TCP|UDP] [--target-port=number-or-name] [--service-name=name] [--public-ip=ip] [--create-external-load-balancer=bool]",
|
||||
Short: "Take a replicated application and expose it as Kubernetes Service",
|
||||
Long: expose_long,
|
||||
Example: expose_example,
|
||||
@@ -61,7 +61,8 @@ func (f *Factory) NewCmdExposeService(out io.Writer) *cobra.Command {
|
||||
cmd.Flags().String("selector", "", "A label selector to use for this service. If empty (the default) infer the selector from the replication controller.")
|
||||
cmd.Flags().StringP("labels", "l", "", "Labels to apply to the service created by this call.")
|
||||
cmd.Flags().Bool("dry-run", false, "If true, only print the object that would be sent, without creating it.")
|
||||
cmd.Flags().String("container-port", "", "Name or number for the port on the container that the service should direct traffic to. Optional.")
|
||||
cmd.Flags().String("container-port", "", "Synonym for --target-port")
|
||||
cmd.Flags().String("target-port", "", "Name or number for the port on the container that the service should direct traffic to. Optional.")
|
||||
cmd.Flags().String("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.")
|
||||
cmd.Flags().String("overrides", "", "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.")
|
||||
cmd.Flags().String("service-name", "", "The name for the newly created service.")
|
||||
|
Reference in New Issue
Block a user