name: proxy synopsis: Run a proxy to the Kubernetes API server description: | To proxy all of the kubernetes api and nothing else, use: kubectl proxy --api-prefix=/ To proxy only part of the kubernetes api and also some static files: kubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/ The above lets you 'curl localhost:8001/api/v1/pods'. To proxy the entire kubernetes api at a different root, use: kubectl proxy --api-prefix=/custom/ The above lets you 'curl localhost:8001/custom/api/v1/pods' options: - name: accept-hosts default_value: ^localhost$,^127\.0\.0\.1$,^\[::1\]$ usage: Regular expression for hosts that the proxy should accept. - name: accept-paths default_value: ^/.* usage: Regular expression for paths that the proxy should accept. - name: address default_value: 127.0.0.1 usage: The IP address on which to serve on. - name: api-prefix default_value: / usage: Prefix to serve the proxied API under. - name: disable-filter default_value: "false" usage: | 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. - name: port shorthand: p default_value: "8001" usage: | The port on which to run the proxy. Set to 0 to pick a random port. - name: reject-methods default_value: POST,PUT,PATCH usage: | Regular expression for HTTP methods that the proxy should reject. - name: reject-paths default_value: ^/api/.*/exec,^/api/.*/run,^/api/.*/attach usage: Regular expression for paths that the proxy should reject. - name: unix-socket shorthand: u usage: Unix socket on which to run the proxy. - name: www shorthand: w usage: | Also serve static files from the given directory under the specified prefix. - name: www-prefix shorthand: P default_value: /static/ usage: | Prefix to serve static files under, if static file directory is specified. inherited_options: - name: alsologtostderr default_value: "false" usage: log to standard error as well as files - name: api-version usage: | DEPRECATED: The API version to use when talking to the server - name: as usage: Username to impersonate for the operation. - name: certificate-authority usage: Path to a cert. file for the certificate authority. - name: client-certificate usage: Path to a client certificate file for TLS. - name: client-key usage: Path to a client key file for TLS. - name: cluster usage: The name of the kubeconfig cluster to use - name: context usage: The name of the kubeconfig context to use - name: insecure-skip-tls-verify default_value: "false" usage: | If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. - name: kubeconfig usage: Path to the kubeconfig file to use for CLI requests. - name: log-backtrace-at default_value: :0 usage: when logging hits line file:N, emit a stack trace - name: log-dir usage: If non-empty, write log files in this directory - name: log-flush-frequency default_value: 5s usage: Maximum number of seconds between log flushes - name: logtostderr default_value: "true" usage: log to standard error instead of files - name: match-server-version default_value: "false" usage: Require server version to match client version - name: namespace usage: If present, the namespace scope for this CLI request. - name: password usage: Password for basic authentication to the API server. - name: server shorthand: s usage: The address and port of the Kubernetes API server - name: stderrthreshold default_value: "2" usage: logs at or above this threshold go to stderr - name: token usage: Bearer token for authentication to the API server. - name: user usage: The name of the kubeconfig user to use - name: username usage: Username for basic authentication to the API server. - name: v default_value: "0" usage: log level for V logs - name: vmodule usage: | comma-separated list of pattern=N settings for file-filtered logging example: |- # Run a proxy to kubernetes apiserver on port 8011, serving static content from ./local/www/ kubectl proxy --port=8011 --www=./local/www/ # Run a proxy to kubernetes apiserver on an arbitrary local port. # The chosen port for the server will be output to stdout. kubectl proxy --port=0 # Run a proxy to kubernetes apiserver, changing the api prefix to k8s-api # This makes e.g. the pods api available at localhost:8011/k8s-api/v1/pods/ kubectl proxy --api-prefix=/k8s-api see_also: - kubectl