How can I copy files between pods or between nodes in the kubernetes cluster?

Is this possible inside the kubernetes cluster?

All examples I've found are copying from a local disk to a pod or vice versa.

Or the only option to copy from node to node, for example over ssh, scp or with other utils?

Thanks for the answers.

1 answer

  • answered 2018-07-19 16:40 jaxxstorm

    It's not possible to do cluster to cluster copying. You'd need to use kubectl cp to copy it locally, then copy the file back:

    kubectl cp <pod>:/tmp/test /tmp/test
    kubctl cp /tmp/test <pod>:/tmp/test

    If you are trying to share files between pods, and only one pods needs write access, you probably want to mount an ro volume on multiple pods, or use an object store like S3. Copying files to and from pods really shouldn't be something you're doing often, that's an anti-pattern