KUBERNETES(1)(kubernetes)
π KUBERNETES(1) β kubectl proxy π
okay bestie, sit down, hydrate, because we're talking about kubectl proxy from the kubernetes manual, section 1. yes it's a real grown-up manpage. yes i'm making it cute. no i'm not skipping a single flag. let's go π«Ά
β¨ NAME β¨
kubectl proxy β Run a proxy to the Kubernetes API server π
π¦ SYNOPSIS π¦
kubectl proxy [OPTIONS]
π DESCRIPTION π
So like, this command creates a proxy server or application-level gateway between localhost and the Kubernetes API server. it's giving middleman, but make it network. π
it also lets you serve static content over a specified HTTP path β yes, static files too, she contains multitudes.
here's the vibe: all incoming data enters through one port and gets forwarded to the remote Kubernetes API server port. the one exception is the path that matches the static content path β that one doesn't get forwarded, she's just serving files. periodt. β¨
π OPTIONS π
--accept-hosts="^localhost$,^127\.0\.0\.1$,^\[::1\]$"β regex for the hosts the proxy is willing to accept. it's the bouncer at the door. πͺ--accept-paths="^.*"β regex for the paths the proxy should accept. by default she's accepting everything, which, okay, generous queen.--address="127.0.0.1"β the IP address to serve on.--api-prefix="/"β the prefix the proxied API gets served under.--append-server-path=falseβ iftrue, turns on automatic path appending of the kube context server path to every single request. β¨--disable-filter=falseβ iftrue, disables request filtering in the proxy. > β οΈ bestie this is dangerous β it can leave you vulnerable to XSRF attacks when used with an accessible port. i'm not being dramatic, the manpage said it first. π--keepalive=0sβkeepalivespecifies the keep-alive period for an active network connection. set it to0to disable keepalive entirely.-p,--port=8001β the port the proxy runs on. set it to0to let it pick a random port (chaotic, love that for her π²).--reject-methods="^$"β regex for HTTP methods the proxy should reject. example:--reject-methods='POST,PUT,PATCH'β blocking the whole trio, iconic behavior.--reject-paths="^/api/./pods/./exec,^/api/./pods/./attach"β regex for paths the proxy should reject. paths listed here get rejected even if--accept-pathsaccepted them. rejection is final, no appeals. π«-u,--unix-socket=""β unix socket to run the proxy on.-w,--www=""β also serve static files from the given directory, under the specified prefix.-P,--www-prefix="/static/"β prefix to serve static files under, if a static file directory is specified.
πΈ OPTIONS INHERITED FROM PARENT COMMANDS πΈ
these aren't hers, she got them from her parent command. nepo baby but the flags are useful so we move. π
--as=""β username to impersonate for the operation. can be a regular user or a service account in a namespace.--as-group=[]β group to impersonate for the operation. repeatable, so you can stack multiple groups. π«--as-uid=""β UID to impersonate for the operation.--as-user-extra=[]β user extras to impersonate for the operation. repeatable, so you can specify multiple values for the same key.--cache-dir="/home/username/.kube/cache"β default cache directory.--certificate-authority=""β path to a cert file for the certificate authority.--client-certificate=""β path to a client certificate file for TLS.--client-key=""β path to a client key file for TLS.--cluster=""β the name of the kubeconfig cluster to use.--context=""β the name of the kubeconfig context to use.--disable-compression=falseβ iftrue, opt out of response compression for all requests to the server.--insecure-skip-tls-verify=falseβ iftrue, the server's certificate will not be checked for validity. > β οΈ this will make your HTTPS connections insecure. literally what it says. π--kubeconfig=""β path to the kubeconfig file to use for CLI requests.--kuberc=""β path to the kuberc file to use for preferences. you can disable this by exportingKUBECTL_KUBERC=falsefeature gate or turning off the feature withKUBERC=off.--match-server-version=falseβ require the server version to match the client version.-n,--namespace=""β if present, the namespace scope for this CLI request.--password=""β password for basic authentication to the API server.--profile="none"β name of the profile to capture. one of(none|cpu|heap|goroutine|threadcreate|block|mutex|trace).--profile-output="profile.pprof"β name of the file to write the profile to.--proxy-url=""β proxy URL to use for requests to the API server.--request-timeout="0"β how long to wait before giving up on a single server request. non-zero values should include a time unit (e.g.1s,2m,3h). a value of zero means don't timeout requests β she waits forever, loyal to a fault. π°οΈ-s,--server=""β the address and port of the Kubernetes API server.--tls-server-name=""β server name to use for server certificate validation. if it's not provided, the hostname used to contact the server is used.--token=""β bearer token for authentication to the API server.--user=""β the name of the kubeconfig user to use.--username=""β username for basic authentication to the API server.--version=falseβ--version,--version=rawprints version information and quits;--version=vX.Y.Z...sets the reported version.--warnings-as-errors=falseβ treat warnings received from the server as errors and exit with a non-zero exit code. harsh but fair. π
β EXAMPLE β
these are verbatim, don't touch them, just read and absorb:
# 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
π SEE ALSO π
π HISTORY π
January 2015, originally compiled by Eric Paris (eparis at redhat dot com) based on the kubernetes source material β but hopefully they have been automatically generated since! (her words, not mine, and honestly? valid.) π
okay that's the whole page, no cap, every single flag accounted for π«Ά
and for the cute sign-off: this lil' manual lives in the Manuals collection, User category, filed under KUBERNETES(1)(kubernetes) β original author credit goes to Eric Paris, Jan 2015. slay, bye bestie π β¨ππ¦πΈπ
π¦ where this page comes from
- arch rolling: kubectl 1.37.2-1 Β· Apache-2.0
- fedora 43: kubernetes1.37-client 1.37.0-3.fc43
- fedora 43: kubernetes1.37-client 1.37.1-1.fc43 Β· Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-3-Clause-HP AND CC-BY-4.0 AND ISC AND MIT AND MPL-2.0
- fedora 44: kubernetes1.37-client 1.37.0-3.fc44
- fedora 44: kubernetes1.37-client 1.37.1-1.fc44 Β· Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-3-Clause-HP AND CC-BY-4.0 AND ISC AND MIT AND MPL-2.0
- nixpkgs unstable: kubectl 1.37.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms