liveBook · Manning

Pod specification

As explained in Learn Docker in a Month of Lunches, Second Edition

A Pod specification is the declarative configuration describing a Pod's metadata and the containers it should run.

A Pod specification is declarative YAML describing a Pod and its containers. At minimum, it names the Pod and identifies each container's image; Kubernetes then schedules the Pod and starts the containers. section 15.2

A Kubernetes resource model uses four top-level fields:

  • apiVersion selects the supported API version. section 15.2
  • kind identifies the resource type, such as Pod. section 15.2
  • metadata names the object and can carry labels. section 15.2
  • spec contains resource-specific configuration, including the Pod's container list. section 15.2

Minimal Pod

apiVersion: v1 kind: Pod metadata: name: pi spec: containers: - name: pi image: kiamol/ch05-pi Apply it with kubectl apply -f pod.yaml, inspect it with kubectl get pods, and read output with kubectl logs pi. A container that exits is replaced by the Pod.

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Defines required YAML fields and deployment behavior, but defers most optional Pod configuration.
Examples
Uses a pi console Pod and a labeled random-number REST API Pod.
What it assumes
Assumes familiarity with containers and Docker images while teaching the minimum Kubernetes resource structure.
What you can do after
Operate Pods via kubectl apply, get, logs, describe, watch, and port-forward.
How it connects
Connects Pods with containers, Docker images, Kubernetes API versions, labels, Services, and kubectl.

Also explained in

Compare how 2 books explain pod specification →

Related concepts

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