KCNA · Question #174
What is the command to list all the available objects in your Kubernetes cluster?
The correct answer is C. kubectl api-resources. The kubectl api-resources command is used to list all the resource types that the Kubernetes API server understands and can be queried.
Question
What is the command to list all the available objects in your Kubernetes cluster?
Options
- Akubectl get all
- Bkubectl get api-resources
- Ckubectl api-resources
- Dkubectl get pods
How the community answered
(36 responses)- A3% (1)
- B6% (2)
- C89% (32)
- D3% (1)
Why each option
The `kubectl api-resources` command is used to list all the resource types that the Kubernetes API server understands and can be queried.
`kubectl get all` lists a subset of common resources, not *all* available API resources.
`kubectl get api-resources` is syntactically incorrect; `api-resources` is a top-level command, not a resource type to `get`.
The `kubectl api-resources` command lists all the available resource types (like Pods, Deployments, Services, etc.) that the Kubernetes API server exposes, indicating what objects can be created and managed in the cluster. This command provides a comprehensive overview of the resource types the API server recognizes.
`kubectl get pods` only lists Pod objects, not all available object types in the cluster.
Concept tested: Listing Kubernetes API resources
Source: https://kubernetes.io/docs/reference/kubectl/cheatsheet/#inspecting-and-finding-resources
Topics
Community Discussion
No community discussion yet for this question.