KUBERNETES(1)(kubernetes)

πŸ’– KUBERNETES(1)(kubernetes) πŸ’–

okay so bestie, this page lives in section 1 of the manual (that's the "kubernetes" manual, iykyk), and the original was written by Eric Paris back in Jan 2015. that's the whole header, we're done with it, now let's get into the good stuff πŸ’…


✨ NAME ✨

kubectl explain β€” get documentation for a resource πŸŽ€


🌸 SYNOPSIS 🌸

kubectl explain [OPTIONS]

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, this command describes the fields and the whole structure of various resources. it's the "wait what even IS this field" command. the main character of "i forgot what spec.containers takes". πŸ’–

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

TYPE.FIELDNAME[.FIELDNAME]

Information about each field is retrieved from the server in OpenAPI format. yes, the server is the one doing the homework here, not your laptop. ✨

and if you want the full list of supported resources? run kubectl api-resources. that's the menu, this is the nutrition label. πŸ“


πŸ‘‘ OPTIONS πŸ‘‘

  • --api-version="" β€” get different explanations for a particular API version (it wants an API group/version, like apps/v1). πŸ¦‹
  • --max-depth=0 β€” maximum recursion depth when printing nested fields with --recursive. 0 means no limit at all, go wild. but heads up: it requires --recursive when it's greater than 0. no --recursive, no depth party. πŸ™ˆ
  • -o, --output="plaintext" β€” the format in which to render the schema. your choices are plaintext and plaintext-openapiv2. that's it, that's the list, it's giving "two options and both are plaintext". πŸ’…
  • -R, --recursive=false β€” print the fields of fields. like, the fields inside the fields. πŸŒ€ use --max-depth to cap the recursion depth so it doesn't spiral forever.

πŸ’œ OPTIONS INHERITED FROM PARENT COMMANDS πŸ’œ

these are the ones you get for free from kubectl itself. they're not this command's own, they're the family hand-me-downs. 🫢

  • --as="" β€” username to impersonate for the operation. user could be a regular user or a service account in a namespace. 🎭
  • --as-group=[] β€” group to impersonate for the operation. this flag can be repeated to specify multiple groups. πŸ”
  • --as-uid="" β€” UID to impersonate for the operation. πŸͺͺ
  • --as-user-extra=[] β€” user extras to impersonate for the operation. this flag can be repeated to specify multiple values for the same key. πŸ”‘
  • --cache-dir="/home/username/.kube/cache" β€” default cache directory. πŸ“
  • --certificate-authority="" β€” path to a cert file for the certificate authority. πŸ”
  • --client-certificate="" β€” path to a client certificate file for TLS. πŸ“œ
  • --client-key="" β€” path to a client key file for TLS. πŸ—οΈ
  • --cluster="" β€” the name of the kubeconfig cluster to use. ☁️
  • --context="" β€” the name of the kubeconfig context to use. 🎯
  • --disable-compression=false β€” if true, opt-out of response compression for all requests to the server. πŸ—œοΈ
  • --insecure-skip-tls-verify=false β€” if true, the server's certificate will not be checked for validity. this will make your HTTPS connections insecure. do not do this casually bestie, this is the "i trust everyone" setting. πŸ’€
  • --kubeconfig="" β€” path to the kubeconfig file to use for CLI requests. πŸ“‚
  • --kuberc="" β€” path to the kuberc file to use for preferences. this can be disabled by exporting the KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off. πŸšͺ
  • --match-server-version=false β€” require server version to match client version. 🀝
  • -n, --namespace="" β€” if present, the namespace scope for this CLI request. 🏠
  • --password="" β€” password for basic authentication to the API server. 🀫
  • --profile="none" β€” name of profile to capture. one of (none|cpu|heap|goroutine|threadcreate|block|mutex|trace). πŸ“Š
  • --profile-output="profile.pprof" β€” name of the file to write the profile to. πŸ“
  • --proxy-url="" β€” proxy URL to use for requests to the API server. 🌐
  • --request-timeout="0" β€” the length of time to wait before giving up on a single server request. non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). a value of zero means don't timeout requests. ⏳
  • -s, --server="" β€” the address and port of the Kubernetes API server. πŸ–₯️
  • --tls-server-name="" β€” server name to use for server certificate validation. if it is not provided, the hostname used to contact the server is used. 🏷️
  • --token="" β€” bearer token for authentication to the API server. 🎫
  • --user="" β€” the name of the kubeconfig user to use. πŸ§‘β€πŸ’»
  • --username="" β€” username for basic authentication to the API server. πŸ™‹
  • --version=false β€” --version, --version=raw prints version information and quits; --version=vX.Y.Z... sets the reported version. πŸ”’
  • --warnings-as-errors=false β€” treat warnings received from the server as errors and exit with a non-zero exit code. ⚠️

🌈 EXAMPLE 🌈

okay here's the fun part, the little field trips you can take. all of these are exactly as written, no cap. πŸ‘‘

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

# Get all the fields in the resource
kubectl explain pods --recursive

# Get fields in the resource up to a specific recursive depth
kubectl explain pods --recursive --max-depth=2

# Get the explanation for deployment in supported api versions
kubectl explain deployments --api-version=apps/v1

# Get the documentation of a specific field of a resource
kubectl explain pods.spec.containers

# Get the documentation of resources in different format
kubectl explain deployment --output=plaintext-openapiv2

⭐ SEE ALSO ⭐


πŸ“œ HISTORY πŸ“œ

January 2015, originally compiled by Eric Paris (eparis at redhat dot com) based on the kubernetes source material, but hopefully they have been automatically generated since! 🧚 manifesting auto-generated docs for everyone, fr fr. ✨


and that's the whole page bestie!! πŸ’– this came from the Manuals set, User section, filed under KUBERNETES(1)(kubernetes) β€” go explain some pods, you got this 🫢🌸

πŸ“¦ where this page comes from