What is apiVersion in Kubernetes? (Part-1)

Reading Time: 2 minutes

Kubernetes apiVersion

When we create Kubernetes resource manifests, one of the first important things that we need to specify for the resource is the apiVersion. For many of the common resources, you might be able to “guess” accurately, but it’s a good skill to be able to figure this out in your cluster. The format of the apiVersion is api_group/version.

An object definition in Kubernetes requires a apiVersion field. When Kubernetes has a release that updates what is available for you to use—changes something in its API—a new apiVersion is created.

Which apiVersion should I use?

Kind apiversion
ComponentStatusv1
ComponentStatusv1
Endpointsv1
Eventv1
LimitRangev1
Namespacev1
Nodev1
PersistentVolumeClaimv1
PersistentVolumev1
Podv1
PodTemplatev1
ReplicationControllerv1
ResourceQuotav1
Secretv1
ServiceAccountv1
Servicev1
ControllerRevisionapps/v1
StatefulSetapps/v1
CronJobbatch/v1beta1
DaemonSetextensions/v1beta1
Deploymentextensions/v1beta1
HorizontalPodAutoscalerautoscaling/v1
Ingressextensions/v1beta1
Jobbatch/v1
NetworkPolicyextensions/v1beta1
CertificateSigningRequestcertificates.k8s.io/v1beta1
ClusterRolerbac.authorization.k8s.io/v1
ClusterRoleBindingrbac.authorization.k8s.io/v1
Rolerbac.authorization.k8s.io/v1
RoleBindingrbac.authorization.k8s.io/v1
ReplicaSetextensions/v1beta1
PodSecurityPolicyextensions/v1beta1
PodDisruptionBudgetpolicy/v1beta1

What does each apiVersion mean?

alpha

API versions with ‘alpha’ in their name are early candidates for new functionality coming into Kubernetes. This is not stable for use. These may contain bugs.

beta

‘beta’ in the API version name means that testing has progressed past alpha level and that the feature will eventually be included in Kubernetes. Although the way it works might change, and the way objects are defined may change completely, the feature itself is highly likely to make it into Kubernetes in some form.

stable

They are safe to use. These do not contain ‘alpha’ or ‘beta’ in their name.

v1

v1 version was the first stable version release of the Kubernetes API. It contains many core objects in Kubernetes.

apps/v1

apps is the most common API group in Kubernetes, with many core objects. It includes various functions like running applications on Kubernetes, like Deployments, RollingUpdates, and ReplicaSets.

autoscaling/v1

This API version autoscaling/v1 allows pods to be autoscaled based on different resource usage metrics. Kubernetes autoscaling helps optimize resource usage and costs by automatically scaling a cluster up and down. Autoscaling is totally dependent on demand.

This stable version includes support for only CPU scaling, but future alpha and beta versions will allow you to scale based on memory usage and custom metrics.

batch/v1

The batch API group contains objects related to batch processing and job-like tasks. This apiVersion is the first stable release of these API objects.

batch/v1beta1

A beta version release with new functionality for batch objects in Kubernetes, including CronJobs that like you can set a specific time and the job will execute at that time or periodicity.

certificates.k8s.io/v1beta1

This API version plays an important role for validate network certificates for secure communication in your cluster.

extensions/v1beta1

This version of the API includes many new and commonly used features of Kubernetes. Deployments, DaemonSets, ReplicaSets, and Ingresses all received significant changes in this release. Using extensions/v1beta1 is becoming deprecated—try to use the specific API group where possible, depending on your Kubernetes cluster version.

policy/v1beta1

Basically, this apiVersion is used to add the new rules around pod security and the ability to set a pod disruption budget.

rbac.authorization.k8s.io/v1

This apiVersion is used for access control. It plays an important role to secure our cluster. It includes more functionality for Kubernetes role-based access control.

Final Thought:

Basically, I have covered all common apiVersion. You can also have a look at Kubernetes documentation. In an upcoming blog, I will explain more about all these apiVersion with proper examples.

Reference – https://matthewpalmer.net/kubernetes-app-developer/articles/kubernetes-apiversion-definition-guide.html

Documentation – https://kubernetes.io/docs/home/

Written by 

Mohd Muzakkir Saifi is a Software Intern at Knoldus Software. He loves to take deep dives into cloud technologies & different tools. His hobbies are playing gymnastics and traveling.

Leave a Reply