mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-29 13:24:42 +00:00
Merge pull request #14819 from mesosphere/sttts-add-kubectl-bind-address
Auto commit by PR queue bot
This commit is contained in:
commit
7f9c18d646
@ -687,6 +687,7 @@ _kubectl_proxy()
|
|||||||
|
|
||||||
flags+=("--accept-hosts=")
|
flags+=("--accept-hosts=")
|
||||||
flags+=("--accept-paths=")
|
flags+=("--accept-paths=")
|
||||||
|
flags+=("--address=")
|
||||||
flags+=("--api-prefix=")
|
flags+=("--api-prefix=")
|
||||||
flags+=("--disable-filter")
|
flags+=("--disable-filter")
|
||||||
flags+=("--port=")
|
flags+=("--port=")
|
||||||
|
@ -46,6 +46,10 @@ The above lets you 'curl localhost:8001/custom/api/v1/pods'
|
|||||||
\fB\-\-accept\-paths\fP="^/.*"
|
\fB\-\-accept\-paths\fP="^/.*"
|
||||||
Regular expression for paths that the proxy should accept.
|
Regular expression for paths that the proxy should accept.
|
||||||
|
|
||||||
|
.PP
|
||||||
|
\fB\-\-address\fP="127.0.0.1"
|
||||||
|
The IP address on which to serve on.
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
\fB\-\-api\-prefix\fP="/api/"
|
\fB\-\-api\-prefix\fP="/api/"
|
||||||
Prefix to serve the proxied API under.
|
Prefix to serve the proxied API under.
|
||||||
|
@ -79,6 +79,7 @@ $ kubectl proxy --api-prefix=/k8s-api
|
|||||||
```
|
```
|
||||||
--accept-hosts="^localhost$,^127\\.0\\.0\\.1$,^\\[::1\\]$": Regular expression for hosts that the proxy should accept.
|
--accept-hosts="^localhost$,^127\\.0\\.0\\.1$,^\\[::1\\]$": Regular expression for hosts that the proxy should accept.
|
||||||
--accept-paths="^/.*": Regular expression for paths that the proxy should accept.
|
--accept-paths="^/.*": Regular expression for paths that the proxy should accept.
|
||||||
|
--address="127.0.0.1": The IP address on which to serve on.
|
||||||
--api-prefix="/api/": Prefix to serve the proxied API under.
|
--api-prefix="/api/": Prefix to serve the proxied API under.
|
||||||
--disable-filter[=false]: If true, disable request filtering in the proxy. This is dangerous, and can leave you vulnerable to XSRF attacks, when used with an accessible port.
|
--disable-filter[=false]: If true, disable request filtering in the proxy. This is dangerous, and can leave you vulnerable to XSRF attacks, when used with an accessible port.
|
||||||
-p, --port=8001: The port on which to run the proxy. Set to 0 to pick a random port.
|
-p, --port=8001: The port on which to run the proxy. Set to 0 to pick a random port.
|
||||||
@ -121,7 +122,7 @@ $ kubectl proxy --api-prefix=/k8s-api
|
|||||||
|
|
||||||
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
|
||||||
|
|
||||||
###### Auto generated by spf13/cobra at 2015-09-10 18:53:03.156927042 +0000 UTC
|
###### Auto generated by spf13/cobra at 2015-09-30 13:52:13.608206963 +0000 UTC
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
|
@ -77,6 +77,7 @@ The above lets you 'curl localhost:8001/custom/api/v1/pods'
|
|||||||
cmd.Flags().String("accept-hosts", kubectl.DefaultHostAcceptRE, "Regular expression for hosts that the proxy should accept.")
|
cmd.Flags().String("accept-hosts", kubectl.DefaultHostAcceptRE, "Regular expression for hosts that the proxy should accept.")
|
||||||
cmd.Flags().String("reject-methods", kubectl.DefaultMethodRejectRE, "Regular expression for HTTP methods that the proxy should reject.")
|
cmd.Flags().String("reject-methods", kubectl.DefaultMethodRejectRE, "Regular expression for HTTP methods that the proxy should reject.")
|
||||||
cmd.Flags().IntP("port", "p", default_port, "The port on which to run the proxy. Set to 0 to pick a random port.")
|
cmd.Flags().IntP("port", "p", default_port, "The port on which to run the proxy. Set to 0 to pick a random port.")
|
||||||
|
cmd.Flags().StringP("address", "", "127.0.0.1", "The IP address on which to serve on.")
|
||||||
cmd.Flags().Bool("disable-filter", false, "If true, disable request filtering in the proxy. This is dangerous, and can leave you vulnerable to XSRF attacks, when used with an accessible port.")
|
cmd.Flags().Bool("disable-filter", false, "If true, disable request filtering in the proxy. This is dangerous, and can leave you vulnerable to XSRF attacks, when used with an accessible port.")
|
||||||
cmd.Flags().StringP("unix-socket", "u", "", "Unix socket on which to run the proxy.")
|
cmd.Flags().StringP("unix-socket", "u", "", "Unix socket on which to run the proxy.")
|
||||||
return cmd
|
return cmd
|
||||||
@ -85,6 +86,7 @@ The above lets you 'curl localhost:8001/custom/api/v1/pods'
|
|||||||
func RunProxy(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command) error {
|
func RunProxy(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command) error {
|
||||||
path := cmdutil.GetFlagString(cmd, "unix-socket")
|
path := cmdutil.GetFlagString(cmd, "unix-socket")
|
||||||
port := cmdutil.GetFlagInt(cmd, "port")
|
port := cmdutil.GetFlagInt(cmd, "port")
|
||||||
|
address := cmdutil.GetFlagString(cmd, "address")
|
||||||
|
|
||||||
if port != default_port && path != "" {
|
if port != default_port && path != "" {
|
||||||
return errors.New("Don't specify both --unix-socket and --port")
|
return errors.New("Don't specify both --unix-socket and --port")
|
||||||
@ -122,7 +124,7 @@ func RunProxy(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command) error {
|
|||||||
// when it is chosen by os (eg: port == 0)
|
// when it is chosen by os (eg: port == 0)
|
||||||
var l net.Listener
|
var l net.Listener
|
||||||
if path == "" {
|
if path == "" {
|
||||||
l, err = server.Listen(port)
|
l, err = server.Listen(address, port)
|
||||||
} else {
|
} else {
|
||||||
l, err = server.ListenUnix(path)
|
l, err = server.ListenUnix(path)
|
||||||
}
|
}
|
||||||
|
@ -179,8 +179,8 @@ func NewProxyServer(filebase string, apiProxyPrefix string, staticPrefix string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Listen is a simple wrapper around net.Listen.
|
// Listen is a simple wrapper around net.Listen.
|
||||||
func (s *ProxyServer) Listen(port int) (net.Listener, error) {
|
func (s *ProxyServer) Listen(address string, port int) (net.Listener, error) {
|
||||||
return net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", port))
|
return net.Listen("tcp", fmt.Sprintf("%s:%d", address, port))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListenUnix does net.Listen for a unix socket
|
// ListenUnix does net.Listen for a unix socket
|
||||||
|
Loading…
Reference in New Issue
Block a user