1KUBERNETES(1)(kubernetes)                            KUBERNETES(1)(kubernetes)
2
3
4
5Eric Paris Jan 2015
6
7

NAME

9       kubectl proxy - Run a proxy to the Kubernetes API server
10
11
12

SYNOPSIS

14       kubectl proxy [OPTIONS]
15
16
17

DESCRIPTION

19       Creates  a  proxy server or application-level gateway between localhost
20       and the Kubernetes API server. It also allows  serving  static  content
21       over specified HTTP path. All incoming data enters through one port and
22       gets forwarded to the remote Kubernetes API server port, except for the
23       path matching the static content path.
24
25
26

OPTIONS

28       --accept-hosts="^localhost$,^127\.0\.0\.1$,^\[::1\]$"       Regular ex‐
29       pression for hosts that the proxy should accept.
30
31
32       --accept-paths="^.*"       Regular expression for paths that the  proxy
33       should accept.
34
35
36       --address="127.0.0.1"      The IP address on which to serve on.
37
38
39       --api-prefix="/"      Prefix to serve the proxied API under.
40
41
42       --append-server-path=false      If true, enables automatic path append‐
43       ing of the kube context server path to each request.
44
45
46       --disable-filter=false      If true, disable request filtering  in  the
47       proxy. This is dangerous, and can leave you vulnerable to XSRF attacks,
48       when used with an accessible port.
49
50
51       --keepalive=0s      keepalive specifies the keep-alive  period  for  an
52       active network connection. Set to 0 to disable keepalive.
53
54
55       -p,  --port=8001       The  port on which to run the proxy. Set to 0 to
56       pick a random port.
57
58
59       --reject-methods="^$"      Regular expression for HTTP methods that the
60       proxy should reject (example --reject-methods='POST,PUT,PATCH').
61
62
63       --reject-paths="^/api/./pods/./exec,^/api/./pods/./attach"      Regular
64       expression for paths that the proxy should reject. Paths specified here
65       will be rejected even accepted by --accept-paths.
66
67
68       -u, --unix-socket=""      Unix socket on which to run the proxy.
69
70
71       -w,  --www=""      Also serve static files from the given directory un‐
72       der the specified prefix.
73
74
75       -P, --www-prefix="/static/"      Prefix to serve static files under, if
76       static file directory is specified.
77
78
79

OPTIONS INHERITED FROM PARENT COMMANDS

81       --as=""      Username to impersonate for the operation. User could be a
82       regular user or a service account in a namespace.
83
84
85       --as-group=[]      Group to impersonate for the  operation,  this  flag
86       can be repeated to specify multiple groups.
87
88
89       --as-uid=""      UID to impersonate for the operation.
90
91
92       --azure-container-registry-config=""       Path  to the file containing
93       Azure container registry configuration information.
94
95
96       --cache-dir="/builddir/.kube/cache"      Default cache directory
97
98
99       --certificate-authority=""      Path to a cert file for the certificate
100       authority
101
102
103       --client-certificate=""      Path to a client certificate file for TLS
104
105
106       --client-key=""      Path to a client key file for TLS
107
108
109       --cluster=""      The name of the kubeconfig cluster to use
110
111
112       --context=""      The name of the kubeconfig context to use
113
114
115       --disable-compression=false       If true, opt-out of response compres‐
116       sion for all requests to the server
117
118
119       --insecure-skip-tls-verify=false      If true, the server's certificate
120       will not be checked for validity. This will make your HTTPS connections
121       insecure
122
123
124       --kubeconfig=""      Path to the kubeconfig file to  use  for  CLI  re‐
125       quests.
126
127
128       --match-server-version=false        Require  server  version  to  match
129       client version
130
131
132       -n, --namespace=""      If present, the namespace scope  for  this  CLI
133       request
134
135
136       --password=""      Password for basic authentication to the API server
137
138
139       --profile="none"         Name   of   profile   to   capture.   One   of
140       (none|cpu|heap|goroutine|threadcreate|block|mutex)
141
142
143       --profile-output="profile.pprof"      Name of the  file  to  write  the
144       profile to
145
146
147       --request-timeout="0"       The length of time to wait before giving up
148       on a single server request. Non-zero values  should  contain  a  corre‐
149       sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
150       out requests.
151
152
153       -s, --server=""      The address and port of the Kubernetes API server
154
155
156       --tls-server-name=""      Server name to  use  for  server  certificate
157       validation.  If  it  is  not provided, the hostname used to contact the
158       server is used
159
160
161       --token=""      Bearer token for authentication to the API server
162
163
164       --user=""      The name of the kubeconfig user to use
165
166
167       --username=""      Username for basic authentication to the API server
168
169
170       --version=false      Print version information and quit
171
172
173       --warnings-as-errors=false      Treat warnings received from the server
174       as errors and exit with a non-zero exit code
175
176
177

EXAMPLE

179                # To proxy all of the Kubernetes API and nothing else
180                kubectl proxy --api-prefix=/
181
182                # To proxy only part of the Kubernetes API and also some static files
183                # You can get pods info with 'curl localhost:8001/api/v1/pods'
184                kubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/
185
186                # To proxy the entire Kubernetes API at a different root
187                # You can get pods info with 'curl localhost:8001/custom/api/v1/pods'
188                kubectl proxy --api-prefix=/custom/
189
190                # Run a proxy to the Kubernetes API server on port 8011, serving static content from ./local/www/
191                kubectl proxy --port=8011 --www=./local/www/
192
193                # Run a proxy to the Kubernetes API server on an arbitrary local port
194                # The chosen port for the server will be output to stdout
195                kubectl proxy --port=0
196
197                # Run a proxy to the Kubernetes API server, changing the API prefix to k8s-api
198                # This makes e.g. the pods API available at localhost:8001/k8s-api/v1/pods/
199                kubectl proxy --api-prefix=/k8s-api
200
201
202
203

SEE ALSO

205       kubectl(1),
206
207
208

HISTORY

210       January  2015,  Originally compiled by Eric Paris (eparis at redhat dot
211       com) based on the kubernetes source material, but hopefully  they  have
212       been automatically generated since!
213
214
215
216Manuals                              User            KUBERNETES(1)(kubernetes)
Impressum