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