Skip to main content
Kubernetes AdministrationMediumSingle Choice

Kubernetes Administration Question

Statement

Which command will list the resource types that exist within a cluster?

#kubectl#api-resources#kubernetes#cluster
A

kubectl api-resources

Correct
B

kubectl get namespaces

C

kubectl api-versions

Resolution & Explanations

The command kubectl api-resources lists all resource types available in the cluster, including built-in and custom resources. It displays the resource name, short names, API version, and whether it is namespaced.

How it Works

kubectl api-resources queries the Kubernetes API server for the OpenAPI schema and aggregates all resource types defined in the cluster. It is useful for discovering available resources and their API groups.

Why the Correct Answer is Right

kubectl api-resources directly fulfills the requirement to list resource types. It is the standard command for this purpose.

Why the Incorrect Answers are Wrong

  • kubectl get namespaces lists only namespaces, not all resource types.
  • kubectl api-versions lists supported API versions (e.g., v1, apps/v1), not resource types.
  • curl https://kubectrl/namespaces is not a valid command; it attempts to access a non-existent endpoint and does not list resource types.