Is there a table that will tell me which set of API versions I should be using, given a k8s cluster version? Kubernetes docs always assume I always have a nice, up-to-date cluster (1.12 at time of writing) but platform providers don't always live on this bleeding edge so it can get frustrating quite quickly.
Better yet, is there a kubectl
command I can run that will let me cluster tell me each resource type and its latest supported API version?
Running kubectl version The command returns two version details with quite verbose output. The server version refers to the version of your Kubernetes API server. The client version refers to the version of your kubectl CLI.
The named groups are at REST path /apis/$GROUP_NAME/$VERSION and use apiVersion: $GROUP_NAME/$VERSION (for example, apiVersion: batch/v1 ). You can find the full list of supported API groups in Kubernetes API reference.
We're pleased to announce the release of Kubernetes 1.23, the last release of 2021! This release consists of 47 enhancements: 11 enhancements have graduated to stable, 17 enhancements are moving to beta, and 19 enhancements are entering alpha.
For getting a list of all the resource types and their latest supported version, run the following:
for kind in `kubectl api-resources | tail +2 | awk '{ print $1 }'`; do kubectl explain $kind; done | grep -e "KIND:" -e "VERSION:"
It should produce output like
KIND: Binding VERSION: v1 KIND: ComponentStatus VERSION: v1 KIND: ConfigMap VERSION: v1 KIND: Endpoints VERSION: v1 KIND: Event VERSION: v1 ...
As @Rico mentioned, they key is in the kubectl explain
command. This may be a little fragile since it depends on the format of the printed output, but it works for kubernetes 1.9.6
Also, the information can be gathered in a less efficient way from the kubernetes API docs (with links for each version) found here - https://kubernetes.io/docs/reference/#api-reference
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With