In this training, we will work with a Pod which contains 2 containers.
Navigate to the folder
04_multi-container-pods
from CLI, before you get started.
cat pod-v1.yaml
kubectl create -f pod-v1.yaml
kubectl logs -f my-pod
This will not work, please follow the instructions or consult
--help
.
-
Exec into the multi-container pod
kubectl exec -it my-pod -- /bin/sh
Pay attention to the output.
-
Find out how to exec into container-b of the Pod
kubectl exec -it my-pod -c container-b -- /bin/sh
-
Inspect pod-v2.yaml definition file and re-create the pod
cat pod-v2.yaml kubectl replace --force -f pod-v2.yaml
-
Verify the output from container-b
kubectl logs -f my-pod -c container-b
- Delete the created resource - pod.
kubectl delete pod my-pod