1KUBERNETES(1)(kubernetes) KUBERNETES(1)(kubernetes)
2
3
4
5Eric Paris Jan 2015
6
7
9 kubectl top pod - Display Resource (CPU/Memory) usage of pods
10
11
12
14 kubectl top pod [OPTIONS]
15
16
17
19 Display Resource (CPU/Memory) usage of pods.
20
21
22 The 'top pod' command allows you to see the resource consumption of
23 pods.
24
25
26 Due to the metrics pipeline delay, they may be unavailable for a few
27 minutes since pod creation.
28
29
30
32 -A, --all-namespaces=false If present, list the requested ob‐
33 ject(s) across all namespaces. Namespace in current context is ignored
34 even if specified with --namespace.
35
36
37 --containers=false If present, print usage of containers within a
38 pod.
39
40
41 --no-headers=false If present, print output without headers.
42
43
44 -l, --selector="" Selector (label query) to filter on, supports
45 '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
46
47
48 --sort-by="" If non-empty, sort pods list using specified field.
49 The field can be either 'cpu' or 'memory'.
50
51
52 --use-protocol-buffers=false If present, protocol-buffers will be
53 used to request metrics.
54
55
56
58 --add-dir-header=false If true, adds the file directory to the
59 header of the log messages
60
61
62 --alsologtostderr=false log to standard error as well as files
63
64
65 --application-metrics-count-limit=100 Max number of application
66 metrics to store (per container)
67
68
69 --as="" Username to impersonate for the operation
70
71
72 --as-group=[] Group to impersonate for the operation, this flag
73 can be repeated to specify multiple groups.
74
75
76 --azure-container-registry-config="" Path to the file containing
77 Azure container registry configuration information.
78
79
80 --boot-id-file="/proc/sys/kernel/random/boot_id" Comma-separated
81 list of files to check for boot-id. Use the first one that exists.
82
83
84 --cache-dir="/builddir/.kube/cache" Default cache directory
85
86
87 --certificate-authority="" Path to a cert file for the certificate
88 authority
89
90
91 --client-certificate="" Path to a client certificate file for TLS
92
93
94 --client-key="" Path to a client key file for TLS
95
96
97 --cloud-provider-gce-l7lb-src-cidrs=130.211.0.0/22,35.191.0.0/16
98 CIDRs opened in GCE firewall for L7 LB traffic proxy health
99 checks
100
101
102 --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
103 CIDRs opened in GCE firewall for L4 LB traffic proxy health
104 checks
105
106
107 --cluster="" The name of the kubeconfig cluster to use
108
109
110 --container-hints="/etc/cadvisor/container_hints.json" location of
111 the container hints file
112
113
114 --containerd="/run/containerd/containerd.sock" containerd endpoint
115
116
117 --containerd-namespace="k8s.io" containerd namespace
118
119
120 --context="" The name of the kubeconfig context to use
121
122
123 --default-not-ready-toleration-seconds=300 Indicates the tolera‐
124 tionSeconds of the toleration for notReady:NoExecute that is added by
125 default to every pod that does not already have such a toleration.
126
127
128 --default-unreachable-toleration-seconds=300 Indicates the tolera‐
129 tionSeconds of the toleration for unreachable:NoExecute that is added
130 by default to every pod that does not already have such a toleration.
131
132
133 --disable-root-cgroup-stats=false Disable collecting root Cgroup
134 stats
135
136
137 --docker="unix:///var/run/docker.sock" docker endpoint
138
139
140 --docker-env-metadata-whitelist="" a comma-separated list of envi‐
141 ronment variable keys matched with specified prefix that needs to be
142 collected for docker containers
143
144
145 --docker-only=false Only report docker containers in addition to
146 root stats
147
148
149 --docker-root="/var/lib/docker" DEPRECATED: docker root is read
150 from docker info (this is a fallback, default: /var/lib/docker)
151
152
153 --docker-tls=false use TLS to connect to docker
154
155
156 --docker-tls-ca="ca.pem" path to trusted CA
157
158
159 --docker-tls-cert="cert.pem" path to client certificate
160
161
162 --docker-tls-key="key.pem" path to private key
163
164
165 --enable-load-reader=false Whether to enable cpu load reader
166
167
168 --event-storage-age-limit="default=0" Max length of time for which
169 to store events (per type). Value is a comma separated list of key val‐
170 ues, where the keys are event types (e.g.: creation, oom) or "default"
171 and the value is a duration. Default is applied to all non-specified
172 event types
173
174
175 --event-storage-event-limit="default=0" Max number of events to
176 store (per type). Value is a comma separated list of key values, where
177 the keys are event types (e.g.: creation, oom) or "default" and the
178 value is an integer. Default is applied to all non-specified event
179 types
180
181
182 --global-housekeeping-interval=1m0s Interval between global house‐
183 keepings
184
185
186 --housekeeping-interval=10s Interval between container housekeep‐
187 ings
188
189
190 --insecure-skip-tls-verify=false If true, the server's certificate
191 will not be checked for validity. This will make your HTTPS connections
192 insecure
193
194
195 --kubeconfig="" Path to the kubeconfig file to use for CLI re‐
196 quests.
197
198
199 --log-backtrace-at=:0 when logging hits line file:N, emit a stack
200 trace
201
202
203 --log-cadvisor-usage=false Whether to log the usage of the cAdvi‐
204 sor container
205
206
207 --log-dir="" If non-empty, write log files in this directory
208
209
210 --log-file="" If non-empty, use this log file
211
212
213 --log-file-max-size=1800 Defines the maximum size a log file can
214 grow to. Unit is megabytes. If the value is 0, the maximum file size is
215 unlimited.
216
217
218 --log-flush-frequency=5s Maximum number of seconds between log
219 flushes
220
221
222 --logtostderr=true log to standard error instead of files
223
224
225 --machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"
226 Comma-separated list of files to check for machine-id. Use the
227 first one that exists.
228
229
230 --match-server-version=false Require server version to match
231 client version
232
233
234 -n, --namespace="" If present, the namespace scope for this CLI
235 request
236
237
238 --one-output=false If true, only write logs to their native sever‐
239 ity level (vs also writing to each lower severity level)
240
241
242 --password="" Password for basic authentication to the API server
243
244
245 --profile="none" Name of profile to capture. One of
246 (none|cpu|heap|goroutine|threadcreate|block|mutex)
247
248
249 --profile-output="profile.pprof" Name of the file to write the
250 profile to
251
252
253 --referenced-reset-interval=0 Reset interval for referenced bytes
254 (container_referenced_bytes metric), number of measurement cycles after
255 which referenced bytes are cleared, if set to 0 referenced bytes are
256 never cleared (default: 0)
257
258
259 --request-timeout="0" The length of time to wait before giving up
260 on a single server request. Non-zero values should contain a corre‐
261 sponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't time‐
262 out requests.
263
264
265 -s, --server="" The address and port of the Kubernetes API server
266
267
268 --skip-headers=false If true, avoid header prefixes in the log
269 messages
270
271
272 --skip-log-headers=false If true, avoid headers when opening log
273 files
274
275
276 --stderrthreshold=2 logs at or above this threshold go to stderr
277
278
279 --storage-driver-buffer-duration=1m0s Writes in the storage driver
280 will be buffered for this duration, and committed to the non memory
281 backends as a single transaction
282
283
284 --storage-driver-db="cadvisor" database name
285
286
287 --storage-driver-host="localhost:8086" database host:port
288
289
290 --storage-driver-password="root" database password
291
292
293 --storage-driver-secure=false use secure connection with database
294
295
296 --storage-driver-table="stats" table name
297
298
299 --storage-driver-user="root" database username
300
301
302 --tls-server-name="" Server name to use for server certificate
303 validation. If it is not provided, the hostname used to contact the
304 server is used
305
306
307 --token="" Bearer token for authentication to the API server
308
309
310 --update-machine-info-interval=5m0s Interval between machine info
311 updates.
312
313
314 --user="" The name of the kubeconfig user to use
315
316
317 --username="" Username for basic authentication to the API server
318
319
320 -v, --v=0 number for the log level verbosity
321
322
323 --version=false Print version information and quit
324
325
326 --vmodule= comma-separated list of pattern=N settings for
327 file-filtered logging
328
329
330 --warnings-as-errors=false Treat warnings received from the server
331 as errors and exit with a non-zero exit code
332
333
334
336 # Show metrics for all pods in the default namespace
337 kubectl top pod
338
339 # Show metrics for all pods in the given namespace
340 kubectl top pod --namespace=NAMESPACE
341
342 # Show metrics for a given pod and its containers
343 kubectl top pod POD_NAME --containers
344
345 # Show metrics for the pods defined by label name=myLabel
346 kubectl top pod -l name=myLabel
347
348
349
350
352 kubectl-top(1),
353
354
355
357 January 2015, Originally compiled by Eric Paris (eparis at redhat dot
358 com) based on the kubernetes source material, but hopefully they have
359 been automatically generated since!
360
361
362
363Manuals User KUBERNETES(1)(kubernetes)