liveBook · Manning

Pod

As explained in Shipping Go: Develop, deliver, discuss, design, and go again

A pod is Kubernetes's smallest deployable execution unit, grouping one or more containers with shared networking and storage context.

A pod groups one or more containers into a unit that Kubernetes can run and scale. A Deployment wraps pods with replica management, health checks, and rollout behavior, while a Service routes requests to them. section 10.3

A practical Kubernetes setup treats the pod as the workload unit and adds surrounding controls:

  • Use a Deployment to define the pod template, container image, exposed port, and desired replica count. section 10.3
  • Use liveness and readiness probes to distinguish a running container from a pod ready to receive traffic. section 10.4
  • Increase replicas when the service needs multiple pod instances for load or availability. section 10.4
  • Place a Service in front of the Deployment to route calls across its pod instances. section 10.3

A health-checked hello-api pod

A hello-api Deployment can run a container image on port 8080, check /health for liveness and readiness, and set replicas to 3. Kubernetes can then direct traffic only to ready pods and replace unhealthy ones. section 10.4

Listing 10.2 deployment.yml
apiVersion: apps/v1
kind: Deployment                     #1
metadata:
  name: hello-api                    #2
spec:
  replicas:                          #3
  selector:
    matchLabels:
        app: hello-api
  template:
    metadata:
      labels:
        app: hello-api
    spec:
      containers:
      - name: hello-api
        imagePullPolicy: Always
        image: gcr.io/PROJECT_NAME/hello-api:latest
        ports:
        - containerPort: 8080        #4
          name: hello-api-svc        #5

Inspect the Deployment YAML showing the pod template, container image, port, labels, and initial replica configuration. section 10.3

Listing 10.4 deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-api
spec:
  replicas: 1
  selector:
    matchLabels:
        app: hello-api
  template:
    metadata:
      labels:
        app: hello-api
    spec:
      containers:
      - name: hello-api
        imagePullPolicy: Always
        image: gcr.io/PROJECT_NAME/hello-api:latest
        ports:
        - containerPort: 8080
          name: hello-api-svc
        livenessProbe:
          httpGet:
            path: /health       #1
            port: 8080
          initialDelaySeconds: 3
          periodSeconds: 3
        readinessProbe:
          httpGet:
            path: /health
            port: 8080
          initialDelaySeconds: 3
          periodSeconds: 3

Inspect the health probe configuration that checks the pod's HTTP health endpoint before routing traffic. section 10.4

Listing 10.5 deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-api
spec:
  replicas: 3       #1
  selector:
    matchLabels:
        app: hello-api
  template:
    metadata:
      labels:
        app: hello-api
    spec:
      containers:
      - name: hello-api
        imagePullPolicy: Always
        image: gcr.io/PROJECT_NAME/hello-api:latest
        ports:
...

Inspect the one-line replica change that produces three running pod instances. section 10.4

How Shipping Go: Develop, deliver, discuss, design, and go again covers it

How deep it goes
Explains pod grouping, scaling, routing, and health checks, but deliberately defers detailed Kubernetes internals.
Examples
Uses hello-api YAML with a container image, port 8080, /health probes, and three replicas.
What it assumes
Assumes container images and HTTP health endpoints, while introducing Kubernetes Deployments, Services, probes, and replicas.
What you can do after
Operate/configure pod workloads with kubectl by defining deployments, adding health checks, and adjusting replica counts.
How it connects
Connects pods to containers, Deployments, replica sets, Services, liveness probes, readiness probes, and health checks.

Also explained in

Compare how 15 books explain pod →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Shipping Go: Develop, deliver, discuss, design, and go again. The section links point to the parts of the book it draws on.