Oxcart 下载
菜单

2026 年 Mac 上的 Kubernetes:kubectl、k9s 与本地集群

在 Apple 芯片 Mac 上,大多数 Kubernetes 工作分为三部分:通过 Mac 上的 kubectl 和 k9s 连接云端或共享集群,为该集群构建镜像,以及在本地运行应用依赖。Oxcart 让这个开发循环保持快速:构建镜像、运行应用及依赖,并先用本地 kwok API 服务器测试清单,再应用到集群。

更新于

适合 Mac 的工作流程

笔记本上的 Kubernetes 集群,往往是实际运行在别处的环境的一份副本。对许多平台和应用开发工作而言,你并不需要这份副本,而是需要对容器本身及其依赖服务获得快速反馈,同时用终端连接真实集群。在 Apple 芯片 Mac 上,这可以分成四项工作。

Mac 上的 Kubernetes 工作及其运行位置
工作工具在 Oxcart 上
查看和操作集群kubectl, k9sMac 原生工具;连接任意 kubeconfig 上下文
为集群构建镜像docker buildx build同时构建 amd64 和 arm64 镜像
运行应用及其依赖docker compose通过健康检查、up --wait 和发布端口启动服务栈
通过 API 服务器测试清单kwok使用真实控制平面和模拟节点及 Pod 检查清单

使用 kubectl 和 k9s 连接集群

kubectl 和 k9s 读取同一个 kubeconfig,因此一个工具能访问的集群,另一个也能浏览。云端 CLI 会帮你写入上下文:aws eks update-kubeconfig、az aks get-credentials 和 gcloud container clusters get-credentials 各自会添加一个上下文。

kubectl config get-contexts          # every cluster in your kubeconfig
kubectl config use-context my-eks    # switch the current context
kubectl get pods -A                  # works against the current context
k9s                                  # the same context, in a terminal UI
k9s --context my-aks --readonly      # another context, read-only

按照 k9s 安装页面的说明,通过 Homebrew 或 MacPorts 安装。为各环境保留独立的 kubeconfig 文件;如果想避免访问生产环境,可用 KUBECONFIG=~/.kube/staging k9s 指定一个文件。

为集群构建镜像

多数集群使用 amd64 节点,而 Mac 是 arm64。Oxcart 上的 Buildx 可以用默认构建器,从同一个 Dockerfile 构建两种架构:

docker buildx ls                     # default builder: linux/amd64, linux/arm64
docker buildx build --platform linux/amd64,linux/arm64 -t myapp:dev .
docker run --rm --platform linux/amd64 myapp:dev   # runs through Rosetta
docker run --rm --platform linux/arm64 myapp:dev   # runs natively

运行本地自行构建的仅含 amd64 的镜像时,请传入 --platform linux/amd64。部署时,每个平台推送一个标签,或让 CI 发布多架构清单,为每个节点选择正确镜像:

docker buildx build --platform linux/amd64 --load -t registry.example.com/myapp:1.4.0-amd64 .
docker push registry.example.com/myapp:1.4.0-amd64

构建很快:Oxcart 对小型本地构建上下文的实测结果,无缓存为 341 ms,有缓存为 121 ms,是我们测试的三个运行时中最快的。docker login 会将镜像仓库密码保存在 macOS 钥匙串中。

使用 Compose 运行应用依赖

正在修改的服务与远程集群通信时,它的数据库、缓存和队列可以运行在 Mac 上。在 compose.yaml 中配置健康检查和 depends_on: condition: service_healthy,通过 docker compose up -d --wait 启动,直到所有服务健康后才返回。完整示例见Apple 芯片 上的 Docker Compose。容器启动足够快,可以在两次测试之间销毁重建:docker run --rm 为 42 ms,停止并移除 20 个容器为 77 ms。

用 kwok 在 Mac 上运行真实 Kubernetes API

kwok(Kubernetes WithOut Kubelet)将真实的控制平面组件作为容器启动,并模拟节点和 Pod。在 Oxcart 上,kwokctl 启动 etcd、kube-apiserver、kube-scheduler 和 kube-controller-manager(v1.36.1),包括拉取镜像在内大约用时 15 秒,Mac 上的 kubectl 和 k9s 均成功连接。

kwokctl create cluster --name dev --runtime docker
kwokctl scale node --replicas 2 --name dev
kubectl apply -f deploy.yaml
kubectl rollout status deploy/web     # "successfully rolled out"
kubectl get pods -o wide              # 3/3 Running on simulated nodes
k9s                                   # browse it like any cluster
kwokctl delete cluster --name dev

你可以用它检查清单能否应用、RBAC 规则是否按预期授权、控制器或 Operator 是否正确调用 API,也可以在不接触共享集群的情况下学习 k9s。Deployment 中的容器并不会真正运行:Pod 是 API 服务器中的记录,由 kwok 标记为 Running。

选择集群的运行位置

在 Mac 上保持快速反馈,同时选择适合团队的集群。共享开发集群让每个人使用相同的控制器、策略和云端集成。如果需要在无法连接该环境时运行真实 Pod,本地集群就很有用。

Oxcart 支持特权容器,满足需要在 Linux 内提升权限的工作负载。完整的 Kubernetes 集群还取决于集群工具的网络和运行时配置。如果需要桌面应用自带集群,请参阅Mac 容器应用对比;日常应用开发则可以用上面的 Compose、Buildx 和 kwok 流程,在本地持续迭代。

从 Mac 使用云端集群

常见问题

Oxcart 如何融入 Kubernetes 工作流程?

用 Oxcart 构建镜像、在本地运行应用及其依赖,并通过本地 kwok API 服务器测试清单。特权容器是平台的内置功能。使用 Mac 上的 kubectl 和 k9s 连接共享或云端集群;Oxcart 本身不捆绑 Kubernetes 集群。

Oxcart 上有可用的本地 Kubernetes API 吗?

有。kwok 将真实 Kubernetes 控制平面(etcd、kube-apiserver、kube-scheduler 和 kube-controller-manager,测试中为 v1.36)作为 Oxcart 容器运行,Mac 上的 kubectl 和 k9s 可以连接。节点和 Pod 是模拟的,因此它适合测试清单、RBAC 和 API 行为,而不是运行应用容器。

kubectl 和 k9s 能在 Apple 芯片 Mac 上运行吗?

能。两者都是 macOS 原生命令行工具,使用你的 kubeconfig,因此可连接其中指向的任何集群:EKS、AKS、GKE、公司集群或本地 API 服务器。k9s 文档提供了通过 Homebrew 和 MacPorts 安装的方法。

如何在 Apple 芯片 Mac 上为 amd64 Kubernetes 集群构建镜像?

使用 Buildx 并指定 --platform linux/amd64,或用 --platform linux/amd64,linux/arm64 同时构建两者。在 Oxcart 上,默认构建器可完成多平台构建,两种架构均可本地运行。Oxcart 不支持推送多平台镜像,因此请为每个平台推送一个标签,或让 CI 发布多架构清单。

在哪里可以运行完整的 Mac 本地 Kubernetes 集群?

有多款 Mac 容器应用内置单节点集群。对比页面提供了比较和来源。许多团队也会连接共享或云端集群进行开发,只在本地运行应用依赖,这正是本指南介绍的流程。

k9s 需要指标服务器吗?

没有也能连接。集群缺少指标 API 时,k9s 会记录警告,并将 CPU 和内存列留空。在我们的 kwok 测试中,它显示“Kubernetes connectivity OK”,同时给出了该警告。

来源与方法

  • 本地 API 示例:Oxcart 0.1.2,Mac17,14,macOS 27.2,2026-10-10;kwokctl v0.8.0、k9s v0.51.0 和 kubectl v1.33.9。
  • kwok:https://kwok.sigs.k8s.io/;k9s:https://k9scli.io/ 和 https://k9scli.io/topics/install/;kind:https://kind.sigs.k8s.io/docs/user/known-issues/;k3d:https://k3d.io/stable/;minikube 驱动:https://minikube.sigs.k8s.io/docs/drivers/。核查日期:2026-10-10。
  • 构建与容器速度:Oxcart 0.1.2,2026-10-10,Apple M5 Max,8 个 CPU 和 12 GiB,取五次采样的中位数;其他运行时于同一天较早时段,在同一台 Mac 上使用相同测量工具及 docker 29.4 客户端测量。

在你自己的项目中试用 Oxcart

免费试用 60 天。之后购买一个许可证,终身包含所有更新,无需订阅。

配备 Apple silicon 的 Mac · Windows 11 (x64)

继续阅读

版本更新说明

Oxcart 26.11.6

最新版本

Containers see the changes you make to files on your Mac as they happen.

  • Edit a file in a shared folder on your Mac, and tools that watch it in a container, such as Vite, webpack and nodemon, reload right away. Polling is not needed.
  • When no containers are running and you haven't used Docker for two minutes, Oxcart gives the memory it was using back to macOS. The next docker command starts it again in under a second. This doesn't happen while Kubernetes is turned on.
  • You can bring your images, volumes and networks over from another Docker app. Choose Import from Another Runtime… in the More (…) menu on the Containers page, or run oxcart import. Containers themselves aren't copied: start them again with docker compose up -d or docker run, and they use the imported volumes and networks.
  • Bug fixes and optimizations.
  • Updated Linux and system components, with the latest security fixes. A Windows virtual machine that is suspended when you update starts fresh afterwards.

需要 macOS 26.0 或更高版本

Oxcart 26.11.5

You can now turn on GPU acceleration for a Windows 11 virtual machine you already have.

  • Open the virtual machine's settings and turn on GPU acceleration under Display. Oxcart restarts Windows once, and the Windows desktop and Direct3D 10 and 11 apps then render on your Mac's GPU.
  • Turning GPU acceleration off puts back the standard display driver, and suspending works again.

需要 macOS 26.0 或更高版本

Oxcart 26.11.4

Bug fixes and optimizations.

  • Virtual machines start again after updating Oxcart while it is open.

需要 macOS 26.0 或更高版本

Oxcart 26.11.3

Windows virtual machines can now use your Mac's GPU.

  • Turn on GPU acceleration when you create a Windows 11 virtual machine, on the first step of New Virtual Machine. The Windows desktop and Direct3D 10 and 11 apps then render on your Mac's GPU instead of its processor.
  • A virtual machine with GPU acceleration can't be suspended or snapshotted while it runs. Shut it down instead. Existing virtual machines are not changed.
  • GPU acceleration is new. After a lot of opening and closing windows, the Windows screen can go black for about a second while Oxcart frees graphics memory.
  • Updated Linux and system components, with the latest security fixes.

需要 macOS 26.0 或更高版本

Oxcart 26.11.2

Oxcart can now run Kubernetes for you.

  • Turn on Kubernetes in Settings › Resources to get a local single-node cluster that kubectl can use right away.
  • Services in the cluster are reachable from your Mac at 127.0.0.1, and images you build with Docker run in the cluster without pushing them to a registry.
  • Updated Linux and system components, with the latest security fixes.

需要 macOS 26.0 或更高版本

Oxcart 26.11.1

Bug fixes and optimizations.

  • A simpler toolbar in the VM window.
  • Updated Linux and system components, with the latest security fixes.

需要 macOS 26.0 或更高版本

Oxcart 26.11.0

Clearer Windows audio, a network that comes back, and a VM toolbar that stays out of your way.

  • Clear Windows audio. Choppy, garbled sound in Windows VMs is fixed.
  • Networking that recovers. Turn a Windows VM's network off and on again, and it reconnects without a restart.
  • A toolbar that stays out of the way. It no longer covers the top of your VM. Move the pointer to the top center and click the small tab when you want it.
  • Simpler Oxcart Tools for Windows. One CD now holds everything, and the installer handles the drivers and any restart for you.
  • A more dependable clipboard in Windows VMs.
  • A license agreement to accept the first time you open Oxcart on your Mac.
  • Updated Linux, container and Docker components, with the latest security fixes.

需要 macOS 26.0 或更高版本

Oxcart 26.10.0

Virtual machines are here. Windows 11, Linux and macOS run on your Mac, built into Oxcart beside your containers and covered by the license you already have.

  • Windows 11 in about 5 minutes, hands off. Choose your Windows 11 ARM installer and walk away: Oxcart installs Windows, its drivers and Oxcart Tools by itself, on a VM with real TPM 2.0 and Secure Boot. You bring the installer and the license.
  • Linux in under a minute. Ubuntu, Debian and Fedora start with your Mac username, your SSH key and passwordless sudo already set up; Fedora is ready in about 30 seconds. Every further VM from the same image starts from an instant copy that takes only the space it changes. Ubuntu Desktop, Fedora Workstation and any arm64 Linux installer work too.
  • macOS on macOS. Oxcart restores the newest macOS your Mac supports and, with Automatic setup, creates your account and installs Oxcart Tools.
  • Every VM is a real Mac app. Each one has its own window, Dock icon and ⌘-Tab entry, and keeps running after you quit Oxcart. The Retina display follows the window as you resize it or go full screen, ⌘C and ⌘V work in Linux and Windows, and text, images and files move between your Mac and the guest by copy, paste and drag.
  • Snapshots that capture the moment. Snapshot a running VM with its open apps and return to that exact moment later. Snapshots and clones take almost no space until the guest changes, and a restore lands whole even if your Mac loses power halfway.
  • Your Mac's folders, network and USB. Share Mac folders with any guest, reach your Mac by name and publish ports from the VM. Hand a USB device to Windows for flashers, programmers and dongles; development boards' serial ports show up in Windows under their own IDs.
  • First-class for coding agents. VMs join containers in Oxcart's MCP server with 22 tools of their own, so an agent you connect can create, start, snapshot and clone VMs, run commands and copy files in the guest, forward ports, connect USB devices and disk images, and read the screen and type in any guest, even one without Oxcart Tools, all within the permission level you set for each agent. The oxcart vm command covers every operation, with JSON output for scripts and CI.
  • Encrypted VMs, when you want them. Keep a VM's disks and secrets behind a password of your own, with AES-256 encryption built into Oxcart, so an encrypted disk flushes as fast as a plain one.
  • Disk space you can see. Choose where a VM lives, on your Mac or an external drive, and see what it takes now and what it can grow to against the space you have. Reclaim Space hands back what a guest frees right away, and Disk Usage shows each downloaded system so you can remove the ones you no longer need.
  • VMs that move with you. Each VM is a single item in Finder you can keep on any drive. Export it as one .oxvm file to another Mac, and bring over Linux and macOS VMs from another Mac virtualization app.
  • Ready when you are. Chosen VMs start when you log in, run headless with no window at all, and suspend when you close them, so you pick up exactly where you left off.
  • Oxcart Help. Help › Oxcart Help (⌘?) explains every setting, what it does and what changing it affects, with a ? beside each one. Coding agents read the same help through MCP.
  • More reliable published ports. A container connection that a service closes mid-transfer now ends cleanly instead of waiting.
  • New version numbers. Releases are now numbered by year and month, so this one is 26.10.0.

需要 macOS 26.0 或更高版本

Oxcart 0.1.8

Oxcart 现已支持 Windows,购买后可终身享有所有更新。

  • Oxcart 也能在 Windows 上运行。一份许可证最多可用于 5 台设备,Mac 与 Windows 可任意组合。
  • 终身包含每次更新。
  • 截至 2026 年 12 月 31 日,Oxcart 售价为 $5。
  • 编程智能体可以检查容器、读取实时统计数据和资源压力、跟踪日志、追踪耗时较长的镜像拉取和构建,并按你设置的限制运行容器。
  • 重新创建容器时会保留其卷和网络别名。
  • Oxcart 的辅助程序在“登录项”中显示为 Oxcart。
  • 全面提升可靠性。

需要 macOS 26.0 或更高版本

Oxcart 0.1.7

更快的共享文件夹、更快的网络,以及可编辑的容器环境。

  • 共享文件夹大幅提速。在共享文件夹中克隆仓库、安装软件包和构建,速度最高可达原来的 3×。
  • 网络更快。发布端口和容器连接可传输近两倍的数据,同时减少 CPU 占用。
  • 按需启用加密。Mac 与容器之间的流量加密是可选的:可在 Settings › Resources › Encrypt container connections 中开启。
  • 环境变量更易查看和修改。在容器的 Overview 中查看变量,通过 Edit and Recreate 修改变量,还能一次粘贴整个 .env 文件。
  • Run Container 面板操作更顺畅。按 Return 会移至下一行,不会启动容器。
  • 故障排查更清晰。当 VPN 或防火墙拖慢连接时,Oxcart 会告知你。
  • 共享文件夹更可靠,能正确报告权限错误,并在 Mac 上的文件发生变更后及时更新内容。

需要 macOS 26.0 或更高版本

Oxcart 0.1.6

编程智能体可以修复所发现的问题,另有全面的问题修复与安全加固。

  • 新添加的智能体可以使用 Mac 上已有的镜像来启动、停止和重启容器,在容器内运行命令,以及启动 Compose 项目。拉取、构建和删除需要 Full 权限,可在 MCP Integrations 中为每个智能体分别设置。
  • 设置时会为每个智能体提供可直接使用的配置条目,运行 oxcart mcp check 可确认其是否正常工作。
  • 回答更准确:智能体能识别服务是否因其依赖的服务停机而停机、网页是否确实能加载,以及故障的原因和修复方法。
  • Start at login 会在登录时将 Oxcart 启动到菜单栏,随时可用。
  • Oxcart 启动时会检查更新,并向 oxcart.cc 发送一条简短的联络请求。Settings › Privacy 中会完整显示其中包含的内容。
  • 容器从启动之初就能发现所在网络中的其他服务。
  • 修复了特权容器、Rosetta 检查和设置过程中的安全防护问题。
  • Oxcart 应用会在执行任何删除数据或停止正在运行的任务的操作前征求确认。
  • 全面加强安全防护并提升可靠性。

需要 macOS 26.0 或更高版本

Oxcart 0.1.5

Oxcart 支持运行本地 Kubernetes 和特权容器,并提供十种语言。

  • 在 Settings › Resources › Kubernetes and networking 中开启特权容器,即可运行 kind、k3d、minikube(Docker 驱动)和 Docker-in-Docker,并使用 docker run --privileged 和 --device。此功能默认关闭。Oxcart 的防护机制会阻止每个容器访问 Oxcart 的磁盘、内核、其他容器的数据,以及 Oxcart 与 Mac 之间的通信通道。
  • 支持 IPv6 容器网络,此功能也默认关闭,适用于使用 IPv6 创建的网络,例如 kind 的双栈网络。
  • Oxcart 已翻译为简体中文、日语、德语、法语、西班牙语、巴西葡萄牙语、韩语、俄语和土耳其语。Settings › General › Language 中的语言设置仅对 Oxcart 生效。

需要 macOS 26.0 或更高版本

Oxcart 0.1.4

许可证功能与细节改进。

  • 通过安全邮件链接激活许可证。
  • 在 Settings 中管理许可证和 Mac。
  • 离线验证许可证。
  • 性能提升、界面优化与问题修复。

需要 macOS 26.0 或更高版本

Oxcart 0.1.3

空闲时回收内存。

  • 没有容器运行时回收 VM 内存。
  • 保留容器、镜像、卷和网络。

需要 macOS 26.0 或更高版本

Oxcart 0.1.2

命令行工具集成。

  • 在 Oxcart 自带的 Docker 工具与已安装的 Docker 工具之间切换。
  • 界面优化。

需要 macOS 26.0 或更高版本

Oxcart 0.1.1

内置 Docker 工具与智能体控制。

  • 自带 Docker CLI 29.9、Compose 5.6 和 Buildx 0.38。
  • Docker 上下文集成与安全的钥匙串凭据存储。
  • MCP 智能体连接,支持为各智能体设置权限或阻止访问。

需要 macOS 26.0 或更高版本

Oxcart 0.1.0

适用于 Apple 芯片的 Docker 兼容容器。

  • 兼容 Docker CLI、Compose 和 Buildx。
  • 自带运行时组件,可离线设置。
  • 按项目和 Git 分支整理端口。
  • MCP 集成,默认仅允许只读访问。
  • 经过验证的自动更新。

需要 macOS 26.0 或更高版本