Sammidbest
Sammidbest

Reputation: 515

Kubernetes : Use of apiVersion in container manifest file

For pod we keep it v1 When replicaset we keep it apps/v1.

Question is apps/v1 contains all the objects of v1 as well or what's the hierarchy? Can someone please explain ?

Upvotes: 2

Views: 803

Answers (1)

Arnaud Develay
Arnaud Develay

Reputation: 3970

The apiVersion is composed of two components: thegroup and the version.

The version indicates the levels of stability and support: if version contains alpha, the software may contains bugs and the feature may be dropped in future release; if version contains beta, the feature is considered tested, and is enabled by default - the feature will not be dropped but some details may change.

The group have been introduced to ease development and maintenance of k8s. The API group is also specified in REST path when accessing the k8s API. The full list of groups is located: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#-strong-api-groups-strong-

So there is no hierarchy between v1 and apps/v1.

The first API resources introduced in Kubernetes do not have groups. So you will use the apiVersion: v1. Later resources are linked to a group. For examples, Jobs and CronJobs are both in the group batch. So their apiVersion will be batch/v1. Deployments and replicasets are in the apps group, and are using apiVersion: apps/v1.

You can obtain all api-resources using the command : kubectl api-resources

See also: https://kubernetes.io/docs/reference/using-api/#api-groups

Upvotes: 3

Related Questions