Kubernetes Pod how to specify two images for a pod [closed] Kubernetes Pod how to specify two images for a pod [closed] kubernetes kubernetes

Kubernetes Pod how to specify two images for a pod [closed]


I think you might want to run multiple containers in a pod with one container using nginx and the other one using redis.

follow the below sample and replace debian with redis

apiVersion: v1kind: Podmetadata:  name: two-containersspec:  restartPolicy: Never  volumes:  - name: shared-data    emptyDir: {}  containers:  - name: nginx-container    image: nginx    volumeMounts:    - name: shared-data      mountPath: /usr/share/nginx/html  - name: debian-container    image: debian    volumeMounts:    - name: shared-data      mountPath: /pod-data    command: ["/bin/sh"]    args: ["-c", "echo Hello from the debian container > /pod-data/index.html"]