Kubectl api-versions vs .Capabilities.APIVersions

Why am I getting the different output for kubectl api-versions and {{- printf “API versions: %v” .Capabilities.APIVersions }} ?

Hi @dnpuneeth3,

kubectl api-versions return only the API versions and .Capabilites.APIVersions return the API versions and resources on the target clusters.

If you want to get the same result as .Capabilites.APIVersions, you can use this command kubectl api-resources

Regard

No, Both kubectl api-versions and .Capabilities.APIVersions return list of API versions.

Hi @dnpuneeth3,

Please below some documentation :

To resume

  • kubectl api-versions ⇾ return the api version for example (apps/v1, batch/v1)
  • Capabilities return what capabilities the Kubernetes cluster supports
    • Capabilities.APIVersions return both the API versions (apps/v1) and also the resources available on each version (apps/v1/Deployment)

Regard