kubectl explain

Exploring the API with kubectl explain and api-resources

You never need to guess a field name. The API server publishes its own schema (OpenAPI v3), and kubectl 5,150 reads it: api-resources lists the object types it serves, and explain documents any field path:

Listing the apps API group and documenting one fieldShell
kubectl api-resources --api-group=apps
kubectl api-resources --no-headers | wc -l
kubectl explain deployment.spec.strategy.rollingUpdate.maxSurge | grep -A2 DESCRIPTION
Output
NAME                  SHORTNAMES   APIVERSION   NAMESPACED   KIND
controllerrevisions                apps/v1      true         ControllerRevision
daemonsets            ds           apps/v1      true         DaemonSet
deployments           deploy       apps/v1      true         Deployment
replicasets           rs           apps/v1      true         ReplicaSet
statefulsets          sts          apps/v1      true         StatefulSet
71
DESCRIPTION:
    The maximum number of pods that can be scheduled above the desired number of
    pods. Value can be an absolute number (ex: 5) or a percentage of desired

This cluster serves 71 types. The SHORTNAMES column is why kubectl get deploy and kubectl get sts work, and NAMESPACED tells you whether a namespace applies at all (Nodes and PersistentVolumes are cluster-wide). The APIVERSION column is what goes into a manifest's apiVersion line. The answers come from your own cluster, so they include custom resources you install later (Operators and CRDs). kubectl explain pod.spec --recursive prints a type's whole tree, and kubectl api-versions lists every served version: a quick check before an upgrade.