Understanding Kubernetes GVR
What is the GVR in Kubernetes? It stands for Group Version Resource and this is what drives the Kubernetes API Server structure. We will cover exactly what the terminology means for Groups, Versions, Resources (and Kinds) and how they fit into the Kubernetes API.
Kinds in Kubernetes relate to the object you are trying to interact with. A
deployment would be your Kind.
There are three categories of Kinds
- Objects : These are your pods, endpoints, deployments, etc.
- Lists : These would be collections of one or more Kinds. Example would be pod list or node list.
- Special Purpose : These are used as specific actions on objects or none persistent objects. Examples would be
A group is simply a collection of kinds. You can have kinds such as ReplicaSets, StatefulSets, and Deployments which are all part of the
One thing to note is that you can have Kinds living in multiple groups. The group may start off as a alpha version in group and as it matures it move be moved into another group.
Versions allow Kubernetes to release groups as tagged versions. Here are the versions that Kubernetes has available.
- Alpha : This is usually disabled by default since they should only be used for testing. You may see these labeled as
- Beta : This is enabled by default. However there is no guarantee that any further beta or stable releases will be backwards compatible. You may see these labeled as
- Stable : These have reached maturity and will be around for further releases. You may see these labeled as
You can have a group exist within any of these versions if not all of the. A group usually starts off in Alpha then moves onto Beta and eventually Stable.
The resource is an identifier that receives and returns a its corresponding kind. Resources also expose CRUD actions for that
Now with a base understanding if we look at the URI for Deployment creation
The uri is as follows:
Now the breakdown for the URI is as follows
If you wanted to get further actions on a resource there are further endpoints available. Here is getting a specific deployment and it’s status
Now, there may be some resources that are cluster wide such as
namespaces . These can be grouped into a GVK (Group Version Kind) where the namespaces is omitted. As opposed to the namespace being part of the resource in a GVR.
This should give you a little more insight into how the API Servers APIs are designed with their URI structure. Along with a new appreciation for what some of the terms such as
resources that you may see your yaml definitions you write for Kubernetes.
If you want some more information about this topic here are some useful links