Kubernetes — apiVersion What To Write Inside ???

Maciej
1 min readMar 30, 2021

How to find out the apiVersion

Sometimes we don’t know what should I write in the apiVersion of the resource like Deployment, Service etc. All Kubernetes resource APIs are written differently depending on which API APIGROUP they belong to apiVersion.

Cases:

  1. If you belong to a particular API GROUP then we use apiVersion: (APIGROUP)/(APIVERSION)
  2. If it does not belong to a specific API GROUP it means that belongs to Core group so we use apiVersion: v1

Check the correspondence between resources and API GROUP

We can check this with using command kubectl api-resources. This is not implemented in the old kubectl for example v1.12, We must remember that running this command will show us information from the current context. If we have several clusters, switch between them.

Result of kubectl command:

Find out which version is available in each API GROUP

Of those belonging to API GROUP other than Core, which version can be used kubectl api-versions.

Result of kubectl command:

--

--

Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.