What is a Pod
A Pod is the unit Kubernetes places on a node
A Pod groups one or more containers that need to run together on the same node. Kubernetes schedules the Pod, not each ordinary container independently. Think of a bookshop catalog process and a small companion that reads its generated index. They can cooperate inside one Pod. A second replica of the shop would normally run in another Pod, not as another copy of the server inside the first one.
Share an address, not every file
In an ordinary Pod with its own network namespace, the containers share the Pod IP and port space. If the catalog listens on port 8080, the reader in the same Pod can connect to http://localhost:8080. A container in another ordinary Pod cannot use its own localhost to reach that catalog. Two processes in the same Pod cannot normally both bind the same address, protocol and port. Container filesystems are separate; files become shared through a deliberately mounted volume. A Pod does not automatically share every process or file with every other container.
Read a two-container manifest
This static manifest is for offline study. The fictional images are intentionally non-resolvable. It has no runnable image or namespace-creation instructions. Assume the catalog writes /work/index.txt and listens on 8080, while the reader reads /input/index.txt. Those are hypothetical application behaviors, not effects produced by the manifest alone.
apiVersion: v1kind: Podmetadata: name: catalog-pair namespace: book-labspec: automountServiceAccountToken: false restartPolicy: Always containers: - name: catalog image: example.invalid/catalog:1 ports: - containerPort: 8080 resources: requests: {cpu: 50m, memory: 32Mi} limits: {cpu: 100m, memory: 64Mi} volumeMounts: - name: shared mountPath: /work - name: reader image: example.invalid/reader:1 resources: requests: {cpu: 25m, memory: 16Mi} limits: {cpu: 50m, memory: 32Mi} volumeMounts: - name: shared mountPath: /input readOnly: true volumes: - name: shared emptyDir: {}Both mounts refer to the same volume named shared; different mount paths point to the same data. The reader mount is read-only. The containerPort field documents the intended port; it does not start a listener or expose a host port. Resource requests describe capacity needed for scheduling and limits bound resource use; later lessons cover enforcement. The token mount is disabled because these fictional apps do not need Kubernetes API credentials.
Lifetime and identity
An emptyDir starts empty when assigned to a node and lasts with the Pod on that node. Restarting one container does not delete that volume. Removing the Pod ends that volume lifetime. A replacement Pod has a different UID and may receive a different IP even when it uses the same name. A Pod cannot move its existing identity to another node. Controllers, introduced later in detail, can create a replacement object; an unmanaged Pod does not automatically acquire that guarantee.
When to group containers
Put containers together if they need close local cooperation and should be placed together. Independently scalable services usually belong in separate Pods, with a Service for discovery (covered later). Do not use a large Pod as a substitute for an entire application architecture. Co-location alone does not guarantee startup order or application health.
Practice
Open lab-fixtures/pod-lifecycle/shared-pod.yaml from the package. Trace the local network path and identify both mount paths. Predict what happens to the index on a reader restart and on Pod replacement. Explain why the two situations differ. No cluster is necessary.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
What is a Pod — knowledge check
Apply the lesson concepts to original offline scenarios.
What does the scheduler place on a node?
How can reader reach catalog listening on 8080 in the same ordinary Pod?
Which file corresponds to catalog writing /work/index.txt in the shared fixture?
What normally happens to emptyDir when just reader restarts?
A replacement Pod reuses the same name. Which fact distinguishes it?