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