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.
Step 1 of 6
The file
web.yamlin 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.
Step 2, not started: With one command, find the pod's IP address and the node it was scheduled to.
Step 3, not started: Print what the
helpercontainer has written to its output, without the nginx logs.Step 4, not started: The
nginxcontainer defines an environment variableAPP_MODE. Print its value from inside that container.Step 5, not started: Delete the pod, then list pods until it is gone. Notice that nothing creates a replacement.
Step 6, not started: Run
nginx:1.31as a Deployment namedwebwith two replicas, so a controller keeps the pods running.
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.