File Operations

Control which files your local process reads and writes remotely

By default, mirrord redirects most file access from your local process to the remote pod. When your code opens /etc/config/app.yaml, it reads the remote pod's copy. This means your local process sees the same configuration files, certificates, and data that the deployed application does.

Some paths, like language runtimes, package managers, and temp files, are always read locally. See the full default listarrow-up-right for details.

Choosing a mode

mirrord supports three file system modes:

Mode
Behavior
Use when

read (default)

Reads from remote, writes locally

You want remote config but don't want to risk writing to remote files

local

All file access stays local

You don't need any remote files

localwithoverrides

All file access local, except paths you specify

You need just a few specific remote files

{
  "feature": {
    "fs": {
      "mode": "read"
    }
  }
}

Reading specific files remotely

Use localwithoverrides when you only need a handful of remote files, for example a config file or TLS certificate:

{
  "feature": {
    "fs": {
      "mode": "localwithoverrides",
      "read_only": ["/etc/config/.*", "/var/secrets/.*"]
    }
  }
}

Paths support regex patterns.

Writing files remotely

If your application writes to files that need to land on the remote filesystem (e.g. uploading to a shared volume), use read_write:

Be careful with remote writes. They modify the actual remote pod's filesystem.

Keeping specific files local

If the default read mode pulls in remote files that conflict with your local setup (e.g. /tmp files, lock files), you can force them to stay local:

Common scenarios

"My app reads config from a mounted ConfigMap" The default read mode handles this. Your local process will read the ConfigMap contents from the remote pod.

"My app writes logs to a file and I don't want them on the remote pod" Default read mode already writes locally. No change needed.

"I only need one remote config file, everything else should be local" Use localwithoverrides with the specific path.

For the full list of file operation settings, see the configuration referencearrow-up-right. For a technical explanation of how file operations work under the hood, see the File Operations reference.

Last updated

Was this helpful?