OC(1)

πŸ“¦
version 4.22.0 Β· 2 versions
, in nixpkgs unstable

✨ OC(1) β€” like, the whole oc api-resources glow-up ✨

Okay bestie, so this is the oc manual page (yes, that oc, the OpenShift CLI one, hi πŸ‘‹) and today we're hyperfixating on one specific command: oc api-resources. It's giving "let me show you what your cluster can actually do" and honestly? Iconic. Let's get into it πŸ’…


🌸 NAME 🌸

oc api-resources β€” print the supported API resources on the server. That's it, that's the vibe. You point it at a server and it tells you every resource type that server is serving up. No cap. πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

oc api-resources [OPTIONS]

Short. Sweet. Main character energy. πŸ’«


πŸ¦‹ DESCRIPTION πŸ¦‹

Print the supported API resources on the server.

Literally just that. It asks the server "hey what resources do you have" and the server tells you. It's the most lowkey useful thing ever and nobody talks about it enough. 🫢


✨ OPTIONS ✨

Here's where it gets juicy. Every single flag, no skipping, periodt:

  • --api-group="" β€” limit to resources in the specified API group. So like, only show me the ones from this group, thanks.
  • --cached=false β€” use the cached list of resources if available. Faster, but it's the cache, so yk. πŸ’€
  • --categories=[] β€” limit to resources that belong to the specified categories.
  • --namespaced=true β€” if false, non-namespaced resources will be returned, otherwise returning namespaced resources by default. (Yeah, read that one twice, I did too πŸ™ˆ β€” default is true, and it's a namespaced-flavoured filter.)
  • --no-headers=false β€” when using the default or custom-column output format, don't print headers (default print headers). So if you want just the rows with zero decoration, this is your girl. ✨
  • -o, --output="" β€” output format. One of: (json, yaml, kyaml, name, wide). Pick your aesthetic πŸ’…
  • --show-managed-fields=false β€” if true, keep the managedFields when printing objects in JSON or YAML format. They're kinda noisy, so default is off, ngl.
  • --sort-by="" β€” if non-empty, sort list of resources using specified field. The field can be either 'name' or 'kind'. Those are the only two, don't get creative πŸ”₯
  • --verbs=[] β€” limit to resources that support the specified verbs. Like "only show me things I can create," for example.

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

These come from the parent oc command, so they apply here too. Big "borrowed from the group chat" energy 🧚

  • --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="/homeless-shelter/.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. 🚨 Bestie. Respectfully. Be careful with this one.
  • --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 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.
  • --profile="none" β€” name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex).
  • --profile-output="profile.pprof" β€” name of the file to write the profile to.
  • --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.
  • --warnings-as-errors=false β€” treat warnings received from the server as errors and exit with a non-zero exit code. Harsh but fair πŸ’€

🌈 EXAMPLE 🌈

Okay this is the part where it all clicks. Copy these, they're exact:

# Print the supported API resources
oc api-resources

# Print the supported API resources with more information
oc api-resources -o wide

# Print the supported API resources sorted by a column
oc api-resources --sort-by=name

# Print the supported namespaced resources
oc api-resources --namespaced=true

# Print the supported non-namespaced resources
oc api-resources --namespaced=false

# Print the supported API resources with a specific APIGroup
oc api-resources --api-group=rbac.authorization.k8s.io

See? -o wide when you want the tea, --sort-by=name when you want order, --namespaced=true/false when you wanna split them up, and --api-group=rbac.authorization.k8s.io when you're being specific specific. Ate. πŸ”₯


πŸ‘‘ SEE ALSO πŸ‘‘

That's the one. Go read it, iykyk 🫢


⭐ HISTORY ⭐

June 2016, Ported from the Kubernetes man-doc generator. So it's been here since 2016 serving looks, we love a veteran πŸ’–


And that's the whole page, bestie! This icon came to you from the Openshift CLI User Manuals (source: Openshift), dated June 2016 β€” so go forth, run oc api-resources, and slay your cluster inventory πŸŽ€πŸ’…βœ¨

πŸ“¦ where this page comes from