How to transfer files from container to container within a pod in Kubernetes?

11/20/2018

There are 5 containers in my pod in kubernetes deployment. I want to transfer files from 1 container to another container.

How to go about this?

-- Vinod Kumar
kubernetes
kubernetes-helm

2 Answers

11/20/2018

You can do that by using shared volume.

Follow this

-- hoque
Source: StackOverflow

11/20/2018

The most common approach to this would be to use EmptyDir volume, run an initContainer that will spin up the image you want to copy from, mount target volume in it and perform the copy, before the actual containers forming your pod runtime will take the same volume and mount it for their use.

If you need to run the copy (transfer) operation during actual operation then you should mount a shared volume (most likely EmptyDir as well) on both containers and just use it as a shared storage space.

-- Radek 'Goblin' Pieczonka
Source: StackOverflow