Rsync in OpenShift

Rsync in OpenShift is not just file copying. It’s a direct stream between your local files and a pod’s filesystem. You connect from the CLI, point it at a container, and push updated files on demand. For hotfixes, quick edits, or syncing large file sets, it’s faster than a new build and deploy cycle.

To use OpenShift rsync, the pod must allow CLI access. Run:

oc rsync ./local-dir <pod-name>:/remote-dir

OpenShift wraps native rsync under the hood, using Kubernetes API tunnels over SSH-like channels. You can pull files too:

oc rsync <pod-name>:/remote-dir ./local-dir

Key options matter.

  • --delete: remove remote files not present locally.
  • --exclude: skip certain files or directories.
  • --no-perms: ignore permission sync if the container runs with enforced modes.

Watch out for permissions and SELinux contexts inside containers. If rsync fails, check pod logs and confirm the container has the rsync binary installed. Many minimal images do not, and you may need a debug pod with the right tooling.

Performance depends on network latency and file count. Large file sets benefit from incremental transfer, where oc rsync sends only changed blocks. For binary assets, compression (-z) can speed up transfers. Keep synced paths tight; avoid sending the whole repo when only a few files changed.

Integrating oc rsync into your workflow means fewer interruptions. You can patch live environments, sync dev artifacts, and keep containers fresh without waiting on CI/CD pipelines. It’s a powerful feature hidden in plain sight.

Stop waiting on rebuilds. Try rsync on OpenShift now, and see it live in minutes at hoop.dev.