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
Syntax
kubectl explain RESOURCE[.FIELD...] [--recursive]
Parameters
| Parameter | Description |
|---|---|
RESOURCE.FIELD |
A resource and dotted field path, e.g. deployment.spec.strategy. |
--recursive |
Show all nested field names. |
Examples
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 notRun this on your computer — see “Get Started” for setup.
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.
Related
kubectl get· List resources in a table, or print them as YAML, JSON, JSONPath or custom columns for scripts and debugging.- kubectl Essentials · tutorial