Take apart a two-container pod

  • 10 min
  • 6 steps
  • Pods and workloads

Steps

0 of 6 done

Create a pod with an nginx container and a helper, inspect each container on its own, then watch a bare pod disappear for good and hand the job to a Deployment.

  1. Step 1 of 6

    The file web.yaml in your working directory describes a pod with two containers. Create the pod and wait until both containers are ready.

    Checked against the cluster as it changes.

  2. Step 2, not started: With one command, find the pod's IP address and the node it was scheduled to.

  3. Step 3, not started: Print what the helper container has written to its output, without the nginx logs.

  4. Step 4, not started: The nginx container defines an environment variable APP_MODE. Print its value from inside that container.

  5. Step 5, not started: Delete the pod, then list pods until it is gone. Notice that nothing creates a replacement.

  6. Step 6, not started: Run nginx:1.31 as a Deployment named web with two replicas, so a controller keeps the pods running.

Lab terminal

Cluster time 30 seconds
kind cluster kx, Kubernetes 1.37.
Each step is checked as you work.
​
Tab completes. Up and Down recall.
Type help for more.
Terminal keys

Enter runs the command. Tab completes, and the arrow keys recall earlier commands. Control C stops a watch. On an empty line, or after Escape, Tab moves focus out of the terminal.