开源项目 GitHub Topic ai-coding 2026-07-06T12:02 正文 ok 623 words

📦 metalbear-co/mirrord:将本地进程无缝接入 Kubernetes 集群

英文标题:📦 metalbear-co/mirrord

mirrord 可让开发者或 AI 编码智能体(如 Claude Code、Cursor)在本地运行代码,同时复用 Kubernetes 集群中真实 Pod 的流量、文件与环境变量,无需部署即可获得端到端验证。该工具已获 monday.com、SurveyMonkey 等知名公司采用,显著缩短反馈循环且不影响集群稳定性。它提供 VS Code 扩展、JetBrains 插件与 CLI,并深度集成 AI 编码代理,为云原生开发带来秒级部署反馈。mirrord 通过代理 Pod 机制将本地进程与集群无缝连接,适用于调试、测试和 AI 代码验证等多种场景。
打开原文相关 3.5 · 机会 5
media18.3 KB media1.3 KB media2.2 KB media1.2 KB media1.3 KB media1.7 KB media201.8 KB media178.8 KB media69.6 KB

中文

社区 Slack GitHub CI 许可证 GitHub 发布(最新语义化版本) X 关注

mirrord 让你的本地进程运行在实时 Kubernetes 集群内部。它对开发者和 AI 编码智能体(Claude Code、Cursor、Codex、Copilot、Windsurf)作用相同:你的代码在你本机运行,但 mirrord 会通过集群中的目标 Pod 来路由其流量、文件和环境变量。

这覆盖了软件开发循环的两个部分。在编写代码时读取实时的集群上下文(真实的环境变量、真实的服务响应、真实的队列内容),使改动基于实际部署的情况。然后针对相同的服务和数据运行代码,以确认它能端到端正常工作。

你在几秒内就能获得部署般的反馈,而无需真正部署,也不会干扰集群中的其他任何人。mirrord 以 VS Code 扩展、IntelliJ 插件和 CLI 工具的形式提供。了解更多。

已被采用:monday.com、SurveyMonkey、Cadence、CoLab、Daylight Security、Zooplus 以及其他。


mirrord 使用你本机的默认 kubeconfig 来访问 Kubernetes API。


在此获取扩展

  • 点击状态栏上的 "Enable mirrord"
  • 开始调试你的项目
  • 选择要模拟的 Pod
  • mirrord 会将调试进程接入选定的 Pod

mirrord VSCode 扩展演示


在此获取插件

  • 点击导航工具栏中的 mirrord 图标
  • 开始调试你的项目
  • 选择命名空间和要模拟的 Pod
  • mirrord 会将调试进程接入选定的 Pod

mirrord IntelliJ 插件演示


你可以通过以下任一方式安装

brew install metalbear-co/mirrord/mirrord

或

curl -fsSL https://raw.githubusercontent.com/metalbear-co/mirrord/main/scripts/install.sh | bash

或使用 Nix(非官方,由社区维护):

使用 nix-env(旧方式)

nix-env -iA nixpkgs.mirrord

使用 nix profile(推荐)

nix profile install nixpkgs#mirrord

或在 Windows 上使用 Chocolatey:

choco install --pre mirrord

用法

mirrord exec --target

例如

mirrord exec node app.js --target pod/my-pod


当你选择要模拟的 Pod 后,mirrord 会在该 Pod 所在的同一节点上启动一个 Pod。这个新 Pod 用于连接你的本地进程和被模拟的 Pod:它将来自该 Pod 的入站流量镜像到你的进程,将你进程的出站流量通过该 Pod 路由,并对文件读取、文件写入和环境变量进行同样的处理。你可以在此了解更多。

在 mirrord 启动的 Pod 内运行的容器需要额外的 Linux capabilities:

  • CAP_NET_ADMIN 和 CAP_NET_RAW - 用于修改路由表
  • CAP_SYS_PTRACE - 用于读取目标 Pod 的环境
  • CAP_SYS_ADMIN - 用于加入目标 Pod 的网络命名空间

不过,你可以在配置中禁用其中任意一个子集。这可能会限制 mirrord 的功能,在某些设置下甚至会使它无法使用。

MIRRORD_AGENT_DISABLED_CAPABILITIES=CAP_NET_RAW,CAP_SYS_PTRACE mirrord exec node app.js --target pod/my-pod

工作原理图

在 AI 编码智能体中使用 mirrord

mirrord 与 Claude Code、Cursor、Codex CLI、Gemini CLI 和其他 AI 编码智能体深度配合,使它们能够在无需部署的情况下,针对真实的集群服务运行并验证生成的代码。

有关设置指南和现成的工作流技能,请参阅 metalbear-co/skills 或 mirrord for AI Agents 页面。

我们的常见问题解答在此。如果你有问题未列其中,请在我们的讨论区或 Slack 上自由提问。

非常欢迎贡献。请先查看我们的开放 issues,并阅读我们的贡献指南。如有任何问题,我们随时在 Slack 上提供帮助。

加入我们的 Slack 讨论问题、寻求支持和找乐子。

我们一直乐于了解 mirrord 如何为用户带来改变。 查看我们的 ADOPTERS.md 了解其他人如何使用 mirrord—— 如果你愿意分享 mirrord 对你组织的帮助,请发起 pull request 将你的组织加入其中。

我们非常重视社区,致力于为每个人提供安全友好的环境。请花几分钟阅读我们的行为准则。

MIT

English / 原文

Community Slack Github CI License GitHub release (latest SemVer) X Follow

mirrord runs your local process inside a live Kubernetes cluster. It works the same way for developers and for AI coding agents (Claude Code, Cursor, Codex, Copilot, Windsurf): your code runs on your machine, but mirrord routes its traffic, files, and environment variables through a target pod in the cluster.

That covers both halves of the software development loop. Read live cluster context while writing the code (real env vars, real service responses, real queue contents) so the change is grounded in what's actually deployed. Then run the code against those same services and data to confirm it works end-to-end.

You get the feedback of a deploy in seconds, without the deploy, and without disrupting the cluster for anyone else. mirrord ships as a VS Code extension, IntelliJ plugin, and CLI tool. Read more.

Adopted by : monday.com, SurveyMonkey, Cadence, CoLab, Daylight Security, Zooplus, and others.


mirrord uses your machine's default kubeconfig for access to the Kubernetes API.


Get the extension here.

  • Click "Enable mirrord" on the status bar
  • Start debugging your project
  • Choose pod to impersonate
  • The debugged process will be plugged into the selected pod by mirrord

demo of mirrord VSCode extension


Get the plugin here.

  • Click the mirrord icon in the Navigation Toolbar
  • Start debugging your project
  • Choose a namespace and pod to impersonate
  • The debugged process will be plugged into the selected pod by mirrord

demo of mirrord IntelliJ plugin


You can use either

brew install metalbear-co/mirrord/mirrord

or

curl -fsSL https://raw.githubusercontent.com/metalbear-co/mirrord/main/scripts/install.sh | bash

or using Nix (not official, community maintained):

# Using nix-env (legacy)
nix-env -iA nixpkgs.mirrord

# Using nix profile (recommended)
nix profile install nixpkgs#mirrord

or on Windows using Chocolatey:

choco install --pre mirrord


mirrord exec <process command> --target <target-path>

e.g.

mirrord exec node app.js --target pod/my-pod

When you select a pod to impersonate, mirrord launches a pod on the same node as the pod you selected. The new pod is then used to connect your local process and the impersonated pod: it mirrors incoming traffic from the pod to your process, routes outgoing traffic from your process through the pod, and does the same for file reads, file writes, and environment variables. You can read more about it here.

Container run inside the pod launched by mirrord requires additional Linux capabilities:

  • CAP_NET_ADMIN and CAP_NET_RAW - for modifying routing tables
  • CAP_SYS_PTRACE - for reading target pod environment
  • CAP_SYS_ADMIN - for joining target pod network namespace

However, you can disable any subset of those in the configuration. This will possibly limit mirrord functionalities or even make it unusable in some setups.

MIRRORD_AGENT_DISABLED_CAPABILITIES=CAP_NET_RAW,CAP_SYS_PTRACE mirrord exec node app.js --target pod/my-pod

How It Works

Using mirrord with AI coding agents

mirrord works first-class with Claude Code, Cursor, Codex CLI, Gemini CLI, and other AI coding agents, letting them run and verify generated code against real cluster services without deploying.

For setup guides and ready-made workflow skills, see metalbear-co/skills or the mirrord for AI Agents page.

Our FAQ is available here. If you have a question that's not on there, feel free to ask in our Discussions or on Slack.

Contributions are very welcome. Start by checking out our open issues, and by going through our contributing guide. We're available on Slack for any questions.

Join our Slack for questions, support and fun.

We always appreciate hearing how mirrord has made a difference for our users.
Check out our ADOPTERS.md to see how others are using mirrord —
and open a pull request to add your organization if you’d like to share how mirrord has been useful to you.

We take our community seriously and we are dedicated to providing a safe and welcoming environment for everyone. Please take a few minutes to review our Code of Conduct.

MIT