How to push content from one pod to other pod?

7/5/2019

I have to push one script from one running pod to other pod in same namespace. Only solution I got, copy from remote to pod. Since I exposed service out of pod, can I do scp from one pod to other by using service name as host name?

-- JavaLearner
docker
kubernetes

1 Answer

7/5/2019

Consider using a ClusterIP service type acts like an internal load balancer for pods and depending on the kube-proxy implementation, will have a balancing algoritm. This means that if you have more than one pod behind the service, it can pick the wrong destination pod.

Using Persitent Volumes seems like a more adequate solution. However, according to the Kubernetes documentation on the persistent volumes access modes, Azure only supports RWO mode, so you might want to alternatively try an external layer of persistence accessible to all of your pods, like setting up an internal NFS service within the cluster.

Finally and the least practical approach, you could try to scp each pod by its IP address or FQDN with all the operation overhead that it might imply.

-- yyyyahir
Source: StackOverflow