Kubernetes Administration
medium

Questão de Kubernetes Administration #019e3a4f

Enunciado da Questão
Kubernetes Administration
#kubectl
#kubernetes
#documentation
#resource-definitions
Médio

Which of these commands is used to retrieve the documentation and field definitions for a Kubernetes resource?

A

kubectl explain

Correta
B

kubectl api-resources

C

kubectl get --help

D

kubectl show

Explicação Oficial / Explicações da Comunidade

The kubectl explain command is used to retrieve documentation and field definitions for Kubernetes resources. It provides detailed information about resource types, including their API version, kind, and a description of each field.

How it Works

kubectl explain queries the Kubernetes API server for the OpenAPI schema of a resource and displays human-readable documentation. For example, kubectl explain pods shows the top-level fields of a Pod, and kubectl explain pods.spec.containers drills down into nested fields.

Why the Correct Answer is Right

kubectl explain is specifically designed to fetch documentation and field definitions for any Kubernetes resource. It is the standard tool for understanding resource structure without needing to consult external documentation.

Why the Incorrect Answers are Wrong

  • kubectl api-resources lists all available API resources (e.g., pods, services) but does not provide field-level documentation or definitions.
  • kubectl get --help shows help for the get command, not resource-specific field definitions.
  • kubectl show is not a valid kubectl command; the correct command for displaying resource details is kubectl describe or kubectl get, but neither provides field definitions like explain does.