1KUBERNETES(1)                      Jan 2015                      KUBERNETES(1)
2
3
4

NAME

6       kubectl attach - Attach to a running container
7
8
9

SYNOPSIS

11       kubectl attach [OPTIONS]
12
13
14

DESCRIPTION

16       Attach to a process that is already running inside an existing
17       container.
18
19
20

OPTIONS

22       -c, --container=""
23           Container name. If omitted, the first container in the pod will be
24       chosen
25
26
27       --pod-running-timeout=1m0s
28           The length of time (like 5s, 2m, or 3h, higher than zero) to wait
29       until at least one pod is running
30
31
32       -i, --stdin=false
33           Pass stdin to the container
34
35
36       -t, --tty=false
37           Stdin is a TTY
38
39
40

OPTIONS INHERITED FROM PARENT COMMANDS

42       --add-dir-header=false
43           If true, adds the file directory to the header
44
45
46       --alsologtostderr=false
47           log to standard error as well as files
48
49
50       --application-metrics-count-limit=100
51           Max number of application metrics to store (per container)
52
53
54       --as=""
55           Username to impersonate for the operation
56
57
58       --as-group=[]
59           Group to impersonate for the operation, this flag can be repeated
60       to specify multiple groups.
61
62
63       --azure-container-registry-config=""
64           Path to the file containing Azure container registry configuration
65       information.
66
67
68       --boot-id-file="/proc/sys/kernel/random/boot_id"
69           Comma-separated list of files to check for boot-id. Use the first
70       one that exists.
71
72
73       --cache-dir="/builddir/.kube/http-cache"
74           Default HTTP cache directory
75
76
77       --certificate-authority=""
78           Path to a cert file for the certificate authority
79
80
81       --client-certificate=""
82           Path to a client certificate file for TLS
83
84
85       --client-key=""
86           Path to a client key file for TLS
87
88
89       --cloud-provider-gce-l7lb-src-cidrs=130.211.0.0/22,35.191.0.0/16
90           CIDRs opened in GCE firewall for L7 LB traffic proxy  health checks
91
92
93       --cloud-provider-gce-lb-src-cidrs=130.211.0.0/22,209.85.152.0/22,209.85.204.0/22,35.191.0.0/16
94           CIDRs opened in GCE firewall for L4 LB traffic proxy  health checks
95
96
97       --cluster=""
98           The name of the kubeconfig cluster to use
99
100
101       --container-hints="/etc/cadvisor/container_hints.json"
102           location of the container hints file
103
104
105       --containerd="/run/containerd/containerd.sock"
106           containerd endpoint
107
108
109       --containerd-namespace="k8s.io"
110           containerd namespace
111
112
113       --context=""
114           The name of the kubeconfig context to use
115
116
117       --default-not-ready-toleration-seconds=300
118           Indicates the tolerationSeconds of the toleration for
119       notReady:NoExecute that is added by default to every pod that does not
120       already have such a toleration.
121
122
123       --default-unreachable-toleration-seconds=300
124           Indicates the tolerationSeconds of the toleration for
125       unreachable:NoExecute that is added by default to every pod that does
126       not already have such a toleration.
127
128
129       --disable-root-cgroup-stats=false
130           Disable collecting root Cgroup stats
131
132
133       --docker="unix:///var/run/docker.sock"
134           docker endpoint
135
136
137       --docker-env-metadata-whitelist=""
138           a comma-separated list of environment variable keys that needs to
139       be collected for docker containers
140
141
142       --docker-only=false
143           Only report docker containers in addition to root stats
144
145
146       --docker-root="/var/lib/docker"
147           DEPRECATED: docker root is read from docker info (this is a
148       fallback, default: /var/lib/docker)
149
150
151       --docker-tls=false
152           use TLS to connect to docker
153
154
155       --docker-tls-ca="ca.pem"
156           path to trusted CA
157
158
159       --docker-tls-cert="cert.pem"
160           path to client certificate
161
162
163       --docker-tls-key="key.pem"
164           path to private key
165
166
167       --enable-load-reader=false
168           Whether to enable cpu load reader
169
170
171       --event-storage-age-limit="default=0"
172           Max length of time for which to store events (per type). Value is a
173       comma separated list of key values, where the keys are event types
174       (e.g.: creation, oom) or "default" and the value is a duration. Default
175       is applied to all non-specified event types
176
177
178       --event-storage-event-limit="default=0"
179           Max number of events to store (per type). Value is a comma
180       separated list of key values, where the keys are event types (e.g.:
181       creation, oom) or "default" and the value is an integer. Default is
182       applied to all non-specified event types
183
184
185       --global-housekeeping-interval=1m0s
186           Interval between global housekeepings
187
188
189       --housekeeping-interval=10s
190           Interval between container housekeepings
191
192
193       --insecure-skip-tls-verify=false
194           If true, the server's certificate will not be checked for validity.
195       This will make your HTTPS connections insecure
196
197
198       --kubeconfig=""
199           Path to the kubeconfig file to use for CLI requests.
200
201
202       --log-backtrace-at=:0
203           when logging hits line file:N, emit a stack trace
204
205
206       --log-cadvisor-usage=false
207           Whether to log the usage of the cAdvisor container
208
209
210       --log-dir=""
211           If non-empty, write log files in this directory
212
213
214       --log-file=""
215           If non-empty, use this log file
216
217
218       --log-file-max-size=1800
219           Defines the maximum size a log file can grow to. Unit is megabytes.
220       If the value is 0, the maximum file size is unlimited.
221
222
223       --log-flush-frequency=5s
224           Maximum number of seconds between log flushes
225
226
227       --logtostderr=true
228           log to standard error instead of files
229
230
231       --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
232           Comma-separated list of files to check for machine-id. Use the
233       first one that exists.
234
235
236       --match-server-version=false
237           Require server version to match client version
238
239
240       -n, --namespace=""
241           If present, the namespace scope for this CLI request
242
243
244       --password=""
245           Password for basic authentication to the API server
246
247
248       --profile="none"
249           Name of profile to capture. One of
250       (none|cpu|heap|goroutine|threadcreate|block|mutex)
251
252
253       --profile-output="profile.pprof"
254           Name of the file to write the profile to
255
256
257       --request-timeout="0"
258           The length of time to wait before giving up on a single server
259       request. Non-zero values should contain a corresponding time unit (e.g.
260       1s, 2m, 3h). A value of zero means don't timeout requests.
261
262
263       -s, --server=""
264           The address and port of the Kubernetes API server
265
266
267       --skip-headers=false
268           If true, avoid header prefixes in the log messages
269
270
271       --skip-log-headers=false
272           If true, avoid headers when opening log files
273
274
275       --stderrthreshold=2
276           logs at or above this threshold go to stderr
277
278
279       --storage-driver-buffer-duration=1m0s
280           Writes in the storage driver will be buffered for this duration,
281       and committed to the non memory backends as a single transaction
282
283
284       --storage-driver-db="cadvisor"
285           database name
286
287
288       --storage-driver-host="localhost:8086"
289           database host:port
290
291
292       --storage-driver-password="root"
293           database password
294
295
296       --storage-driver-secure=false
297           use secure connection with database
298
299
300       --storage-driver-table="stats"
301           table name
302
303
304       --storage-driver-user="root"
305           database username
306
307
308       --tls-server-name=""
309           Server name to use for server certificate validation. If it is not
310       provided, the hostname used to contact the server is used
311
312
313       --token=""
314           Bearer token for authentication to the API server
315
316
317       --update-machine-info-interval=5m0s
318           Interval between machine info updates.
319
320
321       --user=""
322           The name of the kubeconfig user to use
323
324
325       --username=""
326           Username for basic authentication to the API server
327
328
329       -v, --v=0
330           number for the log level verbosity
331
332
333       --version=false
334           Print version information and quit
335
336
337       --vmodule=
338           comma-separated list of pattern=N settings for file-filtered
339       logging
340
341
342

EXAMPLE

344                # Get output from running pod 123456-7890, using the first container by default
345                kubectl attach 123456-7890
346
347                # Get output from ruby-container from pod 123456-7890
348                kubectl attach 123456-7890 -c ruby-container
349
350                # Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-7890
351                # and sends stdout/stderr from 'bash' back to the client
352                kubectl attach 123456-7890 -c ruby-container -i -t
353
354                # Get output from the first pod of a ReplicaSet named nginx
355                kubectl attach rs/nginx
356
357
358
359

SEE ALSO

361       kubectl(1),
362
363
364

HISTORY

366       January 2015, Originally compiled by Eric Paris (eparis at redhat dot
367       com) based on the kubernetes source material, but hopefully they have
368       been automatically generated since!
369
370
371
372Eric Paris                  kubernetes User Manuals              KUBERNETES(1)
Impressum