Two Container Pod Creation

4/30/2020

Create a Pod called sega with two containers:

Container 1: Name tails with image busybox and command: sleep 3600. Container 2: Name sonic with image nginx and Environment variable: NGINX_PORT with the value 8080.

Just I want the yml for this one

-- Suhith Resutha Jayasekara
containers
kubernetes

1 Answer

4/30/2020
apiVersion: v1
kind: Pod
metadata:
  name: sega
spec:
  containers:
  - name: tails
    image: busybox
    command: ["sleep", "3600"]
  - name: sonic
    image: nginx
    env:
    - name: NGINX_PORT
      value: "8080"

To set environment variables in container follow this

This is also a good read for multi-container pod.

-- hoque
Source: StackOverflow