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

NAME

6       kubectl cp - Copy files and directories to and from containers.
7
8
9

SYNOPSIS

11       kubectl cp [OPTIONS]
12
13
14

DESCRIPTION

16       Copy files and directories to and from containers.
17
18
19

OPTIONS

21       -c, --container=""
22           Container name. If omitted, the first container in the pod will be
23       chosen
24
25
26       --no-preserve=false
27           The copied file/directory's ownership and permissions will not be
28       preserved in the container
29
30
31

OPTIONS INHERITED FROM PARENT COMMANDS

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

EXAMPLE

335                # !!!Important Note!!!
336                # Requires that the 'tar' binary is present in your container
337                # image.  If 'tar' is not present, 'kubectl cp' will fail.
338                #
339                # For advanced use cases, such as symlinks, wildcard expansion or
340                # file mode preservation consider using 'kubectl exec'.
341
342                # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace>
343                tar cf - /tmp/foo | kubectl exec -i -n <some-namespace> <some-pod> -- tar xf - -C /tmp/bar
344
345                # Copy /tmp/foo from a remote pod to /tmp/bar locally
346                kubectl exec -n <some-namespace> <some-pod> -- tar cf - /tmp/foo | tar xf - -C /tmp/bar
347
348                # Copy /tmp/foo_dir local directory to /tmp/bar_dir in a remote pod in the default namespace
349                kubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir
350
351                # Copy /tmp/foo local file to /tmp/bar in a remote pod in a specific container
352                kubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container>
353
354                # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace <some-namespace>
355                kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar
356
357                # Copy /tmp/foo from a remote pod to /tmp/bar locally
358                kubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar
359
360
361
362

SEE ALSO

364       kubectl(1),
365
366
367

HISTORY

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