Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 1.66 KB

File metadata and controls

64 lines (50 loc) · 1.66 KB

Multi Container Pods

Multi Container Pods
Tips and Tricks

For simulated Practice problems visit KillerCoda.
  1. create a namespace nano.

    Solution

    k create ns nano

  2. create a pod named worker in nano namespace. create two containers in it one with nginx image, and another with busybox image. In container with busybox image run bash command sleep 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: {}

  3. From the running worker pod in nano namespace, save env variables of busybox container to busybox.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