Hacker News new | ask | show | jobs
by adolph 1808 days ago
Something this guide misses that is helpful about explain is that it can explain down to primaries types. “K explain po” is great, but “k explain po.spec” will give more details about the spec and its fields. This dot field pattern can go as deep as needed, like pod.spec.volumes.secret.items
2 comments

omg TIL `k explain foo` and `k explain foo.spec` is a thing. thank you for this!!!
I'm new to k8s and have found it useful. Hope it helps you too.
Wait What
$ k explain -h

List the fields for supported resources

This command describes the fields associated with each supported API resource. Fields are identified via a simple JSONPath identifier:

  <type>.<fieldName>[.<fieldName>]
  
 Add the --recursive flag to display all of the fields at once without descriptions. Information about each field is
retrieved from the server in OpenAPI format.

Use "kubectl api-resources" for a complete list of supported resources.

Examples: # Get the documentation of the resource and its fields kubectl explain pods

  # Get the documentation of a specific field of a resource
  kubectl explain pods.spec.containers
Options: --api-version='': Get different explanations for particular API version (API group/version) --recursive=false: Print the fields of fields (Currently only 1 level deep)

Usage: kubectl explain RESOURCE [options]

Use "kubectl options" for a list of global command-line options (applies to all commands).

$