Understanding Kubernetes GVK and GVR in 60 Seconds

An individual who uses AI prompts, stack overflow threads and coffee to assemble software that occasionally works as expected...
GVK (Group, Version, Kind):
Group: The API group under which the resource is categorized (e.g.,
apps,core, etc.).Version: The version of the API group (e.g.,
v1,v1beta1, etc.).Kind: The specific type of resource within the API group (e.g.,
Pod,Deployment,Service).
Example:
A Deployment in the
appsgroup and versionv1has a GVK ofapps,v1,Deployment.A Pod has a GVK of
core,v1,Pod.
GVR (Group, Version, Resource):
Group: The API group under which the resource is categorized.
Version: The version of the API group.
Resource: The plural name of the resource as used in the URL path (e.g.,
pods,deployments,services).
Example:
The API endpoint for Pods is
/api/v1/pods, corresponding to GVRcore,v1,pods.The API endpoint for Deployments is
/apis/apps/v1/deployments, corresponding to GVRapps,v1,deployments.
Remember, GVK helps describe the type of a resource (often in YAML files), while GVR is crucial for interacting with the Kubernetes API.




