Listing resources and reading logs

Scope of this page

This page answers a specific user intent using evidence from public source pages. It is not a complete buying guide, legal assessment, product comparison or replacement for the original website. Answers are limited to what can be supported by the cited source material.

Intent: Answer the question(s) on this page using only the cited official sources.

Topic: Kubectl Commands Cheat Sheet

Last updated:

Primary source: https://palark.com/blog/ready-to-use-commands-and-tips-for-kubectl

Quick Info

--all-namespaces, -A. Both list pods across all Kubernetes namespaces.

Purpose and usage

This page provides short, extractable answers for the topic above.

Key points

  • When is kubectl top used?: kubectl top is used when a list of pods that consume CPU and memory resources is needed.
  • How are logs printed with a human-readable timestamp?: Logs are printed with a human-readable timestamp by using the --timestamps flag.
  • How are only the most recent log lines printed?: The most recent lines of a pod's container log are printed with the --tail flag.

Terms and entities

Canonical definitions live on the Facts pages. This page only references them.

Which options list pods across all Kubernetes namespaces?

--all-namespaces, -A. Both list pods across all Kubernetes namespaces.

When is kubectl top used?

kubectl top is used when a list of pods that consume CPU and memory resources is needed.

How are logs printed with a human-readable timestamp?

Logs are printed with a human-readable timestamp by using the --timestamps flag.

How are only the most recent log lines printed?

The most recent lines of a pod's container log are printed with the --tail flag.

Sources

  1. https://palark.com/blog/ready-to-use-commands-and-tips-for-kubectl

Machine metadata