kubectl 1.37 reference · Basics

kubectl explain Command (kubectl)

Show documentation for any resource field straight from the cluster's API schema, including nested fields.

kubectl 1.37

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

kubectl explain RESOURCE[.FIELD...] [--recursive]

Parameters

ParameterDescription
RESOURCE.FIELD A resource and dotted field path, e.g. deployment.spec.strategy.
--recursive Show all nested field names.

Examples

Document one field
kubectl explain deployment.spec.strategy.rollingUpdate.maxUnavailable | sed -n '/DESCRIPTION/,/^$/p' | head -4

Output

DESCRIPTION:
    The maximum number of pods that can be unavailable during the update. Value
    can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
    Absolute number is calculated from percentage by rounding down. This can not

Run this on your computer — see “Get Started” for setup.

List nested fields
kubectl explain pod.spec.containers.resources --recursive | grep -E '^ +(limits|requests|claims)' | sed 's/^ *//'

Output

claims	<[]ResourceClaim>
limits	<map[string]Quantity>
requests	<map[string]Quantity>

Run this on your computer — see “Get Started” for setup.

Was this page helpful?