KCNA · Question #215
What kubectl command is used to retrieve the resource consumption (CPU and memory) for nodes or Pods?
The correct answer is C. kubectl top. To retrieve real-time resource consumption metrics like CPU and memory for nodes or Pods in a Kubernetes cluster, the kubectl top command is used.
Question
What kubectl command is used to retrieve the resource consumption (CPU and memory) for nodes or Pods?
Options
- Akubectl cluster-info
- Ckubectl top
- Dkubectl api-resources
How the community answered
(38 responses)- A5% (2)
- C92% (35)
- D3% (1)
Why each option
To retrieve real-time resource consumption metrics like CPU and memory for nodes or Pods in a Kubernetes cluster, the `kubectl top` command is used.
The `kubectl cluster-info` command provides general information about the cluster, including the master and services, but it does not display resource consumption metrics for individual nodes or Pods.
The `kubectl top` command is specifically designed to fetch and display resource usage metrics, such as CPU and memory consumption, for nodes and Pods within a Kubernetes cluster by querying the Metrics API.
The `kubectl api-resources` command lists the various API resource types available in the cluster, such as deployments, services, and pods, but it does not show their current resource usage.
Concept tested: Kubernetes resource monitoring with kubectl
Source: https://kubernetes.io/docs/reference/kubectl/generated/kubectl_top/
Topics
Community Discussion
No community discussion yet for this question.