liveBook · Manning

Version

As explained in Kubernetes in Action, Second Edition

An API version identifies a versioned Kubernetes API schema for a resource kind, including its available fields and default values.

An API version identifies the schema used to describe a Kubernetes resource kind, including its available fields and default values. It appears with kind in an object manifest’s type metadata. section 4.2.1 section 4.1.2

The value can include an API group as well as a version. Core resources such as Nodes use v1; grouped resources such as Deployments use apps/v1. section 4.2.1

API versions matter because they:

  • Define which fields describe a kind and which default values apply. section 4.2.2
  • Identify the representation used when accessing an object through an API resource. section 4.1.1
  • Let kubectl explain display the schema for a selected version, including nested fields. section 4.2.2

A Pod manifest

apiVersion: v1 kind: Pod metadata: name: kiada spec: containers: - name: kiada image: luksa/kiada:0.1 ports: - containerPort: 8080 Here, v1 selects the Kubernetes API schema used to describe the Pod. section 5.2.1

Listing 5.1 A basic pod manifest file
apiVersion: v1      #1
kind: Pod      #2
metadata:     
  name: kiada     #3
spec: 
  containers:
  - name: kiada      #4
    image: luksa/kiada:0.1     #5
    ports: 
    - containerPort: 8080      #6

Inspect a complete basic Pod manifest and see the apiVersion field alongside kind, metadata, and spec. section 5.2.1

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains schema differences, default values, API groups, resource representations, and kubectl inspection, but not version conversion internals.
Examples
Uses v1 Node and Pod manifests, apps/v1 Deployments, and historical extensions/v1beta1 Deployment access.
What it assumes
Assumes familiarity with Kubernetes object manifests and kinds while establishing API schema, groups, and version selection.
What you can do after
Apply it via kubectl by selecting compatible apiVersion values and inspecting schemas with kubectl explain.
How it connects
Connects API schema, API group, kind, object manifest, resource, and kubectl explain.

Also explained in

Compare how 5 books explain version →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.