kubectl proxy [page]deterministic
Run a proxy to the Kubernetes API server
##
Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote Kubernetes API server port, except for the path matching the static content path.
``` kubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix] ```
##
``` # To proxy all of the Kubernetes API and nothing else kubectl proxy --api-prefix=/ # To proxy only part of the Kubernetes API and also some static files # You can get pods info with 'curl localhost:8001/api/v1/pods' kubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/ # To proxy the entire Kubernetes API at a different root # You can get pods info with 'curl localhost:8001/custom/api/v1/pods' kubectl proxy --api-prefix=/custom/ # Run a proxy to the Kubernetes API server on port 8011, serving static content from ./local/www/ kubectl proxy --port=8011 --www=./local/www/ # Run a proxy to the Kubernetes API server on an arbitrary local port # The chosen port for the server will be output to stdout kubectl proxy --port=0 # Run a proxy to the Kubernetes API server, changing the API prefix to k8s-api # This makes e.g. the pods API available at localhost:8001/k8s-api/v1/pods/ kubectl proxy --api-prefix=/k8s-api ```
##
<table style="width: 100%; table-layout: fixed;"> <colgroup> <col span="1" style="width: 10px;" /> <col span="1" /> </colgroup> <tbody>
<tr> <td colspan="2">--accept-hosts string Default: "^localhost$,^127\.0\.0\.1$,^\[::1\]$"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Regular expression for hosts that the proxy should accept.</p></td> </tr>
<tr> <td colspan="2">--accept-paths string Default: "^.*"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Regular expression for paths that the proxy should accept.</p></td> </tr>
<tr> <td colspan="2">--address string Default: "127.0.0.1"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>The IP address on which to serve on.</p></td> </tr>
<tr> <td colspan="2">--api-prefix string Default: "/"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Prefix to serve the proxied API under.</p></td> </tr>
<tr> <td colspan="2">--append-server-path</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If true, enables automatic path appending of the kube context server path to each request.</p></td> </tr>
<tr> <td colspan="2">--disable-filter</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>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></td> </tr>
<tr> <td colspan="2">-h, --help</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>help for proxy</p></td> </tr>
<tr> <td colspan="2">--keepalive duration</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>keepalive specifies the keep-alive period for an active network connection. Set to 0 to disable keepalive.</p></td> </tr>
<tr> <td colspan="2">-p, --port int Default: 8001</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>The port on which to run the proxy. Set to 0 to pick a random port.</p></td> </tr>
<tr> <td colspan="2">--reject-methods string Default: "^$"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Regular expression for HTTP methods that the proxy should reject (example --reject-methods='POST,PUT,PATCH').</p></td> </tr>
<tr> <td colsp …(trimmed)