KUBERNETES(1)(kubernetes)

πŸ’– KUBERNETES(1)(kubernetes) πŸ’–

hiii bestie 🌸 welcome to the manual page for kubectl top pod, filed under KUBERNETES(1)(kubernetes) in the Manuals section, User subsection, and originally put together by Eric Paris, Jan 2015. this one's short and sweet, and it's about ✨metrics✨. let's get into it 🫢


✨ NAME ✨

kubectl top pod β€” display resource (CPU/memory) usage of pods πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

kubectl top pod [OPTIONS]

that's it. that's the whole vibe check. πŸ’…


🌈 DESCRIPTION 🌈

okay so basically: display resource (CPU/memory) usage of pods. that's the whole job, that's the main character energy right there πŸ”₯

the top pod command lets you peek at the resource consumption of pods. like, how much CPU and memory are these lil guys actually eating. very demure, very mindful, very observant of you. πŸ“

⚠️ real talk tho: due to the metrics pipeline delay, the numbers may be unavailable for a few minutes since pod creation. so if your brand new pod shows up with nothing, don't panic, it's not ghosting you, it's just ✨cooking✨. give it a minute 😭

πŸ’… OPTIONS πŸ’…

  • -A, --all-namespaces=false β€” if present, list the requested object(s) across all namespaces. the namespace in your current context gets ignored, even if you specified it with --namespace. she does not care about your context, she's looking at everything πŸ‘€
  • --containers=false β€” if present, print usage of the containers within a pod. zoom in, get the receipts per container 🧚
  • --field-selector="" β€” selector (field query) to filter on. supports =, ==, and !=. (e.g. --field-selector key1=value1,key2=value2). heads up: the server only supports a limited number of field queries per type, so don't get too wild with it πŸ’€
  • --no-headers=false β€” if present, print output without headers. just the raw data, no labels, no small talk πŸ™ˆ
  • -l, --selector="" β€” 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 β€” no partial credit, it's all or nothing periodt πŸ’–
  • --show-swap=false β€” print pod resources related to swap memory. swap girlies rise up πŸŒ€
  • --sort-by="" β€” if non-empty, sort the pods list using the specified field. the field can be either 'cpu' or 'memory'. that's the whole menu, pick one 🌸
  • --sum=false β€” print the sum of the resource usage. math but make it cluster ops ✨
  • --use-protocol-buffers=true β€” enables using protocol-buffers to access the Metrics API. (yes, the default is true, she's already doing it πŸŽ€)

πŸ‘‘ OPTIONS INHERITED FROM PARENT COMMANDS πŸ‘‘

these are the ones that come down from the parent command, the family recipe, if you will 🫢

  • --as="" β€” username to impersonate for the operation. user could be a regular user or a service account in a namespace. be someone else, lowkey iconic 🎭
  • --as-group=[] β€” group to impersonate for the operation. this flag can be repeated to specify multiple groups. stack 'em πŸ’…
  • --as-uid="" β€” UID to impersonate for the operation.
  • --as-user-extra=[] β€” user extras to impersonate for the operation. this flag can be repeated to specify multiple values for the same key.
  • --cache-dir="/home/username/.kube/cache" β€” default cache directory. that's literally the default path, character for character, don't come for me πŸ“
  • --certificate-authority="" β€” path to a cert file for the certificate authority.
  • --client-certificate="" β€” path to a client certificate file for TLS.
  • --client-key="" β€” path to a client key file for TLS.
  • --cluster="" β€” the name of the kubeconfig cluster to use.
  • --context="" β€” the name of the kubeconfig context to use.
  • --disable-compression=false β€” if true, opt-out of response compression for all requests to the server.
  • --insecure-skip-tls-verify=false β€” if true, the server's certificate will not be checked for validity. > ⚠️ this will make your HTTPS connections insecure. like, genuinely insecure. proceed with your eyes open bestie, this is not a cute flex πŸ’€
  • --kubeconfig="" β€” path to the kubeconfig file to use for CLI requests.
  • --kuberc="" β€” path to the kuberc file to use for preferences. this can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.
  • --match-server-version=false β€” require server version to match client version. no mismatched energy allowed πŸ™…
  • -n, --namespace="" β€” if present, the namespace scope for this CLI request.
  • --password="" β€” password for basic authentication to the API server.
  • --profile="none" β€” name of profile to capture. one of (none|cpu|heap|goroutine|threadcreate|block|mutex|trace). seven options, pick your fighter ✨
  • --profile-output="profile.pprof" β€” name of the file to write the profile to.
  • --proxy-url="" β€” proxy URL to use for requests to the API server.
  • --request-timeout="0" β€” the length of time to wait before giving up on a single server request. non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). a value of zero means don't timeout requests. zero = infinite patience, she'll wait forever πŸ•°οΈ
  • -s, --server="" β€” the address and port of the Kubernetes API server.
  • --tls-server-name="" β€” server name to use for server certificate validation. if it is not provided, the hostname used to contact the server is used.
  • --token="" β€” bearer token for authentication to the API server.
  • --user="" β€” the name of the kubeconfig user to use.
  • --username="" β€” username for basic authentication to the API server.
  • --version=false β€” --version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version.
  • --warnings-as-errors=false β€” treat warnings received from the server as errors and exit with a non-zero exit code. no chill mode, warnings are now crimes 🚨

πŸŽ€ EXAMPLE πŸŽ€

copy these, they're correct, character for character, i'm not playing πŸ™

# 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

look at you go, topping pods like a pro πŸ’–


🌟 SEE ALSO 🌟

(the comma is in the original, i'm keeping the comma, i don't make the rules πŸ’…)


πŸ“œ HISTORY πŸ“œ

January 2015, originally compiled by Eric Paris (eparis at redhat dot com) based on the kubernetes source material, but hopefully they have been automatically generated since! β€” that's literally what it says and honestly? love that for them, so real 😭


and that's the whole page bestie πŸ¦‹ this was KUBERNETES(1)(kubernetes) from the Manuals section, User subsection β€” go check your pods' vibes, stay hydrated, and remember the metrics might need a few minutes to show up πŸ’œβœ¨

πŸ“¦ where this page comes from