Every Kubernetes resource belongs to an API Group and API Version.
The
apiVersion field tells Kubernetes which API endpoint should
process the resource definition.
Common Kubernetes API Versions
| API Version | Common kind Values |
|---|---|
v1
|
Pod, Service, PersistentVolume, PersistentVolumeClaim, ConfigMap, Secret, Namespace |
apps/v1
|
Deployment, StatefulSet, DaemonSet, ReplicaSet |
batch/v1
|
Job, CronJob |
networking.k8s.io/v1
|
Ingress, NetworkPolicy |
rbac.authorization.k8s.io/v1
|
Role, ClusterRole, RoleBinding |
storage.k8s.io/v1
|
StorageClass |
autoscaling/v2
|
HorizontalPodAutoscaler |
Checking Supported API Versions
You can check all API versions supported by your
Kubernetes cluster by running the following command:
kubectl api-versions
Sample Output
Below is an example response from a Kubernetes cluster:
admissionregistration.k8s.io/v1 apiextensions.k8s.io/v1 apiregistration.k8s.io/v1 apps/v1 authentication.k8s.io/v1 authorization.k8s.io/v1 autoscaling/v1 autoscaling/v2 batch/v1 certificates.k8s.io/v1 coordination.k8s.io/v1 discovery.k8s.io/v1 events.k8s.io/v1 flowcontrol.apiserver.k8s.io/v1 monitoring.coreos.com/v1 monitoring.coreos.com/v1alpha1 networking.k8s.io/v1 node.k8s.io/v1 policy/v1 rbac.authorization.k8s.io/v1 scheduling.k8s.io/v1 storage.k8s.io/v1 v1
Understanding API Groups
| API Group | Purpose |
|---|---|
v1
|
Core Kubernetes resources such as Pods, Services, ConfigMaps, and Secrets. |
apps
|
Workload controllers such as Deployments, StatefulSets, and DaemonSets. |
batch
|
Batch-processing resources such as Jobs and CronJobs. |
networking.k8s.io
|
Networking resources such as Ingresses and NetworkPolicies. |
rbac.authorization.k8s.io
|
Role-Based Access Control (RBAC) resources. |
storage.k8s.io
|
Storage-related resources such as StorageClasses. |
autoscaling
|
Auto-scaling resources such as HorizontalPodAutoscalers. |
Practical Rule:
When creating a Kubernetes manifest, always verify that the
apiVersion you use exists in the output of
kubectl api-versions. API versions may differ across
Kubernetes releases, and older versions are eventually deprecated and removed.
No comments:
Post a Comment