kubectl-api-versions
List Kubernetes API versions
TLDR
Print the supported API versions on the server, in the form of "group/version"
SYNOPSIS
kubectl api-versions [flags]
PARAMETERS
-h, --help
Display help for api-versions
--raw
Fetch and print raw URI response
--request-timeout duration
Timeout for server requests (default 0s)
--allow-missing-template-keys
Ignore missing keys in templates (default true)
--template string
Go template for output formatting
--validate
Validate input with schema (if applicable)
DESCRIPTION
kubectl api-versions queries the Kubernetes API server to print all supported API versions, ordered by server preference.
This command retrieves data from the server's /apis endpoint, displaying group versions like v1, apps/v1, batch/v1beta1, and others available in the cluster. It helps administrators and developers verify API compatibility, discover supported resources, and troubleshoot version mismatches during deployments or upgrades.
Unlike kubectl api-resources, which lists resource types per version, this focuses solely on versions per API group. Output is plain text, one per line, making it script-friendly for parsing.
By default, it contacts the current context's server. Use with --raw to fetch raw JSON from a specific URI. Ideal for CI/CD pipelines to validate cluster capabilities before applying manifests.
EXAMPLES
kubectl api-versions
Lists all server API versions.
kubectl api-versions --raw=/apis
Fetches raw API list.
OUTPUT EXAMPLE
v1
apps/v1
batch/v1
extensions/v1beta1
...
HISTORY
Available since Kubernetes v1.0 (2014); stable core kubectl subcommand for API discovery, unchanged in core functionality across major releases.
SEE ALSO
kubectl version(1), kubectl api-resources(1), kubectl explain(1)


