Understanding Kubernetes GVR

Image for post
Image for post
Photo by Dakota Roos on Unsplash

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.

Kind

Kinds in Kubernetes relate to the object you are trying to interact with. A pod or deployment would be your Kind.

There are three categories of Kinds

Group

A group is simply a collection of kinds. You can have kinds such as ReplicaSets, StatefulSets, and Deployments which are all part of the apps group.

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.

Version

Versions allow Kubernetes to release groups as tagged versions. Here are the versions that Kubernetes has available.

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.

Resource

The resource is an identifier that receives and returns a its corresponding kind. Resources also expose CRUD actions for that Kind .

API URI

Now with a base understanding if we look at the URI for Deployment creation

The uri is as follows:

POST /apis/apps/v1/namespaces/{namespace}/deployments

Now the breakdown for the URI is as follows

POST /apis/{GROUP}/{VERSION}/namespaces/{namespace}/{KIND}

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

GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}
GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status

Now, there may be some resources that are cluster wide such as nodesor 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.

GET /api/v1/nodes

To summarize

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 kinds groups 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

Written by

Gopher with a keen interest in cloud native

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store