kubectl top pod [page]deterministic
Display resource (CPU/memory) usage of pods
##
Display resource (CPU/memory) usage of pods.
The 'top pod' command allows you to see the resource consumption of pods.
Due to the metrics pipeline delay, they may be unavailable for a few minutes since pod creation.
``` kubectl top pod [NAME | -l label] ```
##
``` # Show metrics for all pods in the default namespace kubectl top pod # Show metrics for all pods in the given namespace kubectl top pod --namespace=NAMESPACE # Show metrics for a given pod and its containers kubectl top pod POD_NAME --containers # Show metrics for the pods defined by label name=myLabel kubectl top pod -l name=myLabel ```
##
<table style="width: 100%; table-layout: fixed;"> <colgroup> <col span="1" style="width: 10px;" /> <col span="1" /> </colgroup> <tbody>
<tr> <td colspan="2">-A, --all-namespaces</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.</p></td> </tr>
<tr> <td colspan="2">--containers</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If present, print usage of containers within a pod.</p></td> </tr>
<tr> <td colspan="2">--field-selector string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.</p></td> </tr>
<tr> <td colspan="2">-h, --help</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>help for pod</p></td> </tr>
<tr> <td colspan="2">--no-headers</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If present, print output without headers.</p></td> </tr>
<tr> <td colspan="2">-l, --selector string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Selector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.</p></td> </tr>
<tr> <td colspan="2">--show-swap</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Print pod resources related to swap memory.</p></td> </tr>
<tr> <td colspan="2">--sort-by string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If non-empty, sort pods list using specified field. The field can be either 'cpu' or 'memory'.</p></td> </tr>
<tr> <td colspan="2">--sum</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Print the sum of the resource usage</p></td> </tr>
<tr> <td colspan="2">--use-protocol-buffers Default: true</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Enables using protocol-buffers to access Metrics API.</p></td> </tr>
</tbody> </table>
##
<table style="width: 100%; table-layout: fixed;"> <colgroup> <col span="1" style="width: 10px;" /> <col span="1" /> </colgroup> <tbody>
<tr> <td colspan="2">--as string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Username to impersonate for the operation. User could be a regular user or a service account in a namespace.</p></td> </tr>
<tr> <td colspan="2">--as-group strings</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Group to impersonate for the operation, this flag can be repeated to specify multiple groups.</p></td> </tr>
<tr> <td colspan="2">--as-uid string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>UID to impersonate for the operation.</p></td> </tr>
<tr> <td colspan="2">--as-user-extra strings</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>User extras to …(trimmed)