liveBook · Manning

Pod

As explained in gRPC Microservices in Go

A Kubernetes Pod is the smallest deployable unit in Kubernetes and encapsulates one or more containers that share network and storage resources.

A Pod is Kubernetes’ smallest deployable unit. Instead of deploying a container directly, define a Pod for the application and its runtime configuration. The Pod runs on a worker node; the scheduler chooses an available node according to its resource requirements. section 8.2.2 section 8.2.1

A Pod specification supplies what the workload needs to run:

  • A container image and version, plus environment variables such as an application port or another service’s URL. section 8.2.2 section 8.2.4
  • When needed, resource reservations, configuration from ConfigMaps or Secrets, and disk claims. section 8.2.2
apiVersion: v1
kind: Pod
metadata:
  name: order
spec:
  containers:
  - name: order
    image: huseyinbabal/order:1.0.0
    env:
      - name: APPLICATION_PORT
        value: "8080"
      - name: "PAYMENT_SERVICE_URL"
            value: "payment:8081"

The Order Pod manifest names the container image and passes APPLICATION_PORT and PAYMENT_SERVICE_URL as environment variables. section 8.2.4

Create the Order Pod

Save the manifest as order.yaml and run `kubectl apply -f order.yaml`. kubectl sends it to the API server, its metadata is stored in etcd, the scheduler assigns a node, and that node’s kubelet pulls the image and runs the container. section 8.2.4

A single Pod is not the whole production deployment. Use a Deployment when the service needs multiple instances or managed image updates: its ReplicaSet creates Pods from a template. Use a Service to expose Pods as an endpoint; Service selectors can also route requests across old and new Pods during a canary rollout. section 8.2.5 section 8.4.3

How gRPC Microservices in Go covers it

How deep it goes
Works through an Order Pod manifest and its scheduling flow, then delegates replication and updates to Deployments.
Examples
Uses an Order service Pod with image and environment variables, plus a two-replica Payment service Deployment.
What it assumes
Assumes a runnable container image and required service configuration; introduces the Pod manifest and kubectl application flow.
What you can do after
Apply it via kubectl to create a Pod, then use a Deployment for multiple instances and managed updates.
How it connects
Connects Pods to the scheduler, kubelet, Deployments, ReplicaSets, Services, and canary deployment.

Also explained in

Compare how 15 books explain pod →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of gRPC Microservices in Go. The section links point to the parts of the book it draws on.