跳到正文
Skillpedia
部署与云(DevOps)48k · #5212

mirrord

它能做什么

mirrord 让你可以在本地运行程序,就像它运行在 Kubernetes 集群中的容器(pod)里一样。它会把 pod 的环境、网络连接和流量复制到你的电脑上,让测试变得更轻松。

适用场景

  • ✓在不部署改动的情况下,用真实服务来测试你的修改。
  • ✓对照预发布环境在本地调试某个微服务。
  • ✓第一次尝试 mirrord 时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/mirrord/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/mirrord/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我想在本地用预发布环境测试我新写的 API。”

每周 5 个新技能,1 分钟读完。

工作原理

mirrord 会在你的 Kubernetes 集群中安装一个小程序(称为 agent)。这个 agent 会把你选定的 pod 的环境和流量镜像到你的本地电脑上。这样,你的本地代码就能像在集群内部一样,与集群中的真实服务进行交互。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

mirrord

Overview

mirrord runs a local process as if it were inside a Kubernetes pod: it gets the pod's environment variables, DNS, outgoing network access and file reads, and can receive the pod's incoming traffic. An agent can verify a change against the real services, databases and queues in a staging cluster without building or deploying an image.

When to Use This Skill

  • Use when a change needs to be tested against real cluster dependencies instead of mocks
  • Use when the user asks to debug a microservice locally against staging
  • Use when the user wants to try mirrord for the first time

How It Works

Step 1: Check cluster access

kubectl cluster-info
kubectl get pods -A | head -5

If this fails, help the user configure kubectl first.

Step 2: Install mirrord

Point the user to the official installation guide (https://metalbear.com/mirrord/docs/overview/quick-start/) for Homebrew, package managers, or pinned release binaries. Do not pipe a remote download into a shell. Verify with:

mirrord --version

Step 3: Pick a target and run

mirrord ls
mirrord exec --target deployment/<name> -- <command>

Incoming traffic is mirrored by default. To take over the target's traffic instead, set "feature": {"network": {"incoming": "steal"}} in .mirrord/mirrord.json, and confirm with the user first, since it affects a shared environment.

Step 4: Verify

# Verify an explicitly selected non-secret variable or service identity without printing the pod environment.

Confirm the exact target and mode through sanitized configuration/status, then an approved synthetic read. Never dump environment credentials.

Examples

Example 1: Run tests against staging

mirrord exec --target deployment/orders -- npm test

Example 2: Debug a Python service

mirrord exec --target deployment/api -- python main.py

Best Practices

  • ✅ Ask which cluster, namespace and target before running
  • ✅ Prefer mirror mode on shared clusters
  • ✅ Use the official skills at https://github.com/metalbear-co/skills for config, CI, database branching, queue splitting and preview environments
  • ❌ Don't steal traffic from a shared target without the user's agreement
  • ❌ Don't run cluster-modifying commands without explicit approval

Limitations

  • Needs kubectl access to the target cluster and a Linux node kernel 4.20+
  • Team features (concurrent steal on one target, database branching, queue splitting, preview environments) need the mirrord Operator. On a cluster without a license, an agent can offer the user a trial; see https://metalbear.com/agents.md and ask before starting it.

Running locally can still modify shared databases, send messages, consume queues or incur provider charges through mirrored network/environment access. Confirm a staging context/namespace and isolated data, inspect the actual mirrord mode/version, and disable unneeded filesystem/environment/network capabilities. Mirror mode is not an automatic read-only sandbox; stealing traffic or trial/license activation needs specific authorization. Reconcile side effects before retries.

常见问题

我需要在电脑上安装什么吗?

需要,你要在自己的电脑上安装 mirrord。官方指南会介绍不同操作系统的安装方法。

“镜像流量”和 “窃取流量”有什么区别?

镜像流量是把 pod 的流量复制一份到你的电脑上,pod 仍然正常接收原本的流量。窃取流量则是让你的电脑接收原本发给 pod 的所有流量,如果操作不当,可能会影响其他用户。

使用 mirrord 需要满足什么条件?

你需要有权限访问 Kubernetes 集群,并配置好 `kubectl`,同时你的电脑需要使用较新的 Linux 内核。

详情

作者的原始描述

Run a local process inside a live Kubernetes cluster's network, env and traffic with mirrord, so changes are tested against real services without deploying.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5212
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能