KCNA · Question #14
Which command will list the resource types that exist within a cluster?
The correct answer is A. kubectl api-resources. The kubectl api-resources command is used to display the list of all available resource types and their short names within a Kubernetes cluster.
Question
Which command will list the resource types that exist within a cluster?
Options
- Akubectl api-resources
- Ckubectl api-versions
- Dcurl https://kubectrl/namespaces
How the community answered
(33 responses)- A94% (31)
- C3% (1)
- D3% (1)
Why each option
The `kubectl api-resources` command is used to display the list of all available resource types and their short names within a Kubernetes cluster.
The `kubectl api-resources` command queries the Kubernetes API server to retrieve a comprehensive list of all resource types that the API server recognizes. This includes details like their API group, version, and whether they are namespace-scoped, making it the correct command for discovering available cluster resources.
`kubectl api-versions` lists the API versions supported by the Kubernetes API server, not the resource types themselves.
This is an invalid `curl` command syntax for directly querying Kubernetes resources and is not the standard `kubectl` way to list resource types.
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.