Multi Container Pods
Tips and Tricks
For simulated Practice problems visit KillerCoda.
-
Solution
k create ns nano
-
create a pod named
worker
innano
namespace. create two containers in it one withnginx
image, and another withbusybox
image. In container with busybox image run bash commandsleep 3600
.Solution
apiVersion: v1 kind: Pod metadata: creationTimestamp: null labels: run: worker name: worker spec: containers: - image: nginx name: nginx - image: busybox name: busybox command: ["sh","-c","sleep 3600"] dnsPolicy: ClusterFirst restartPolicy: Always status: {}
-
From the running
worker
pod innano
namespace, saveenv
variables of busybox container tobusybox.txt
file.Solution
# check for the running pod k get po -n nano # list the env of busybox container & save it to a file k exec -ti worker -n nano -c busybox -- env # or k exec -ti worker -n nano -c busybox -- printenv > busybox.txt