DEV Community

Alex Spinov
Alex Spinov

Posted on

mirrord Has a Free API: Run Local Code in Your Kubernetes Cluster Context

Why mirrord Exists

Developing microservices locally is broken. Your service works on localhost but fails in Kubernetes because it depends on other services, databases, configs. mirrord lets you run local code as if it were inside the cluster — without deploying.

Install

brew install metalbear-co/mirrord/mirrord

# Or VS Code extension
code --install-extension MetalBear.mirrord
Enter fullscreen mode Exit fullscreen mode

Run Local Code in Cluster Context

# Run your local process with cluster networking
mirrord exec --target pod/my-app-abc123 -- node server.js

# Or target a deployment
mirrord exec --target deployment/my-app -- python app.py
Enter fullscreen mode Exit fullscreen mode

Your local process now:

  • Receives traffic from the cluster
  • Can access cluster DNS (other services, databases)
  • Reads environment variables from the target pod
  • Reads files from the target pod filesystem

Configuration

{
  "target": {
    "path": "deployment/my-app",
    "namespace": "dev"
  },
  "feature": {
    "network": {
      "incoming": "mirror",
      "outgoing": true,
      "dns": true
    },
    "fs": "read",
    "env": true
  }
}
Enter fullscreen mode Exit fullscreen mode
mirrord exec -f config.json -- ./my-app
Enter fullscreen mode Exit fullscreen mode

Traffic Modes

  • Mirror — copy incoming traffic to local (non-destructive)
  • Steal — redirect traffic to local (for testing)
  • Steal with filter — only redirect specific requests
{
  "feature": {
    "network": {
      "incoming": {
        "mode": "steal",
        "http_filter": {
          "header_filter": "x-debug: true"
        }
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

IDE Integration

VS Code

  1. Install the mirrord extension
  2. Click the mirrord button in the status bar
  3. Select target pod/deployment
  4. Hit F5 — your debugger runs in cluster context

IntelliJ

  1. Install the mirrord plugin
  2. Enable mirrord in run configuration
  3. Debug as usual — breakpoints work with cluster traffic

Key Features

  • No deployment needed — run local code with cluster context
  • Traffic mirroring/stealing — test with real requests
  • Env vars and files — inherited from target pod
  • DNS resolution — access all cluster services by name
  • IDE integration — VS Code, IntelliJ, GoLand
  • Zero config — works out of the box for most setups

mirrord vs Alternatives

Feature mirrord Telepresence Port-forward
Traffic mirror Yes Yes No
Steal filter Header-based Intercept N/A
Env vars Auto-imported Manual Manual
Setup Zero Agent install kubectl
IDE support VS Code, JetBrains Limited None

Resources


Need to extract Kubernetes configs, service mesh data, or cluster metrics? Check out my Apify tools or email spinov001@gmail.com for custom solutions.

Top comments (0)