Skip to content

Commit 434cf04

Browse files
committed
Updates to the Slicer for Mac info
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent fcfb58a commit 434cf04

File tree

4 files changed

+50
-13
lines changed

4 files changed

+50
-13
lines changed

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Slicer for Mac:
4949
* On macOS, Slicer for Mac uses [Apple’s Virtualization Framework](https://developer.apple.com/documentation/virtualization).
5050
* Mac guests can use VirtioFS folder sharing for local paths.
5151
* Mac guests support Rosetta for x86_64 Linux binaries.
52+
* Networking uses [VZNATNetworkDeviceAttachment](https://developer.apple.com/documentation/virtualization/vznatnetworkdeviceattachment) for Internet access
5253

5354
* Slicer runs as a daemon and exposes API, CLI, and SDK management for microVM host groups.
5455
* You define host groups and VM specs in YAML before launching VMs. These cannot be created via API at this point in time. Host groups need to have [non-overlapping networking](/reference/networking/) CIDRs defined.

docs/mac/overview.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22

33
Slicer for Mac was built from the ground up to run Linux microVMs on Apple Silicon.
44

5-
It uses the same familiar API and CLI from Slicer for Linux, but instead of using KVM, leans heavily on Apple's native [Virtualization framework](https://developer.apple.com/documentation/virtualization).
5+
It uses the same familiar API and CLI from Slicer for Linux, using Apple's native [Virtualization framework](https://developer.apple.com/documentation/virtualization) instead of KVM. Only Arm64 hosts and guests are supported, however Rosetta support can be enabled to run Intel/AMD binaries.
66

7-
Typical use-cases include: disposable sandboxes for agents, running local Kubernetes clusters, or getting access to a real Linux system, instead of making do with POSIX compatibility.
7+
Typical use-cases include:
88

9-
Slicer microVMs boot very quickly and have some advanced features like Rosetta for running Intel/AMD binaries, and folder sharing.
9+
* Real Linux with systemd instead of POSIX compatibility
10+
* Sandboxes for AI coding agents
11+
* Local Kubernetes testing and development
12+
* Exploring software like Hermes Agent or OpenClaw without polluting your Mac
13+
14+
Files can be shared to a microVM via folder sharing using virtiofs, or by `slicer cp` (zero networking copy).
1015

1116
!!! note "macOS versions"
12-
Slicer for Mac is available on all Slicer license tiers. We've tested on macOS Sequoia and Tahoe. `slicer-mac` does not need `sudo`. Intel Macs are out of scope for Slicer at this time, but you could install Linux on them, and use Slicer for Linux instead.
17+
Slicer for Mac is available on all Slicer license tiers. We've tested on macOS Sequoia and Tahoe. `slicer-mac` does not need `sudo`. Intel Macs are out of scope for Slicer at this time, but you could install Linux on them directly, and use Slicer for Linux instead.
1318

1419
## How it works
1520

@@ -25,9 +30,9 @@ If you need to run x86_64 binaries, see [Enable Rosetta](/mac/rosetta) after the
2530
The config file for Slicer for Mac is named `slicer-mac.yaml`, it defines two host groups. Host groups launch and manage microVMs. The names are flexible on Slicer for Linux, but Slicer for Mac has two fixed groups instead.
2631

2732
- The `slicer` group - a runs a Linux VM that start-up and stays running. This is your day-to-day Linux environment, similar to WSL on Windows, and is fully persistent.
28-
- The ``sbox` group aka "sandbox" - is for ephemeral VMs launched on demand through the CLI, API, or by one of your AI coding agents. They are permanently deleted when you shut them down, shut down Slicer for Mac, or delete them via `slicer vm delete NAME`.
33+
- The `sbox` group aka "sandbox" - is for ephemeral VMs launched on demand through the CLI, API, or by one of your AI coding agents. These VMs are ephemeral by default, but can be made permanent via `slicer vm launch sbox --persistent`
2934

30-
# Architecture (conceptual)
35+
## Conceptual architecture
3136

3237
```text
3338
+----------------------------+
@@ -55,11 +60,27 @@ The config file for Slicer for Mac is named `slicer-mac.yaml`, it defines two ho
5560
+-------------+ +----------------+
5661
```
5762

58-
Docker's socket is port-forwarded to your Mac as a Unix socket, so `docker` commands on the Mac talk directly to the VM. K3s exposes port 6443, so `kubectl` on your Mac can target the cluster running inside `slicer-1`. It feels like you're on Linux.
63+
A typical flow, might be to install Docker in `slicer-1`, and then port-forward it back to the host using its UNIX socket, so you can run `docker` directly on your machine.
64+
65+
In a similar way, a sandbox such as `sbox-1` may have K3s installed, exposing port 6443. You can access that by copying the KUBECONFIG file back to your local machine and using the sandbox's IP or the `slicer vm forward` command.
66+
67+
## Networking
68+
69+
Slicer for Mac uses Apple's [VZNATNetworkDeviceAttachment](https://developer.apple.com/documentation/virtualization/vznatnetworkdeviceattachment). Guests access the Internet through your host.
70+
71+
* The host can ingress to guests using their IP or `slicer vm forward`
72+
* Guests can talk to the host to access things like HTTP proxies, or a Docker pull-through cache, etc.
73+
* Unlike Slicer for Linux, which supports bridged mode networking, guests on Slicer for Mac cannot talk to each other, unless you install an overlay network using something like Wireguard, routing through the host.
74+
75+
Firewall rules can be set up using `pf` to prevent guests from accessing certain IP ranges. You can also write your own intercepting proxy, and have `pf` force all NAT traffic through it to enforce your own filtering.
5976

6077
## Storage
6178

62-
Unlike Slicer for Linux (which supports [devmapper](/storage/devmapper) and [ZFS](/storage/zfs) CoW backends), the Mac version uses image-backed storage. The OCI image is unpacked once, then cloned instantly using APFS' native Copy-on-Write. Launching a new sandbox doesn't copy the entire disk.
79+
Slicer for Mac uses image-backed storage for each virtual machine. The OCI image for the root filesystem and Kernel is unpacked once, then cloned instantly using APFS' native Copy-on-Write support. Launching a new sandbox doesn't copy the entire disk, and only deltas are actually allocated to the host's disk.
80+
81+
If the base image is a `10GB` file, when you launch a new VM, no new bytes will be allocated, until the guest starts to change or add new files.
82+
83+
Slicer for Linux supports ZFS and devmapper for Copy-on-Write support.
6384

6485
## MacBooks and sleep
6586

docs/mac/storage.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Storage on Slicer for Mac
22

3-
Slicer for Mac stores VM state using a base image flow with copy-on-write clones.
3+
Slicer for Mac stores VM disks using a raw disk image. Whenever a new VM is launched, a base image file is cloned instantly using the Copy-on-Write (CoW) support of APFS.
44

55
You can set storage size per host group with `storage_size` in `slicer-mac.yaml`.
66

77
Use `nG` style values (for example `15G`), and set at least `5G` to give enough initial headroom.
88

9-
Sparse files are used, so disk space is not allocated up front. A declared size of `15G` represents logical size and grows as data is written.
9+
Sparse files are used, so disk space is not allocated up front. A declared size of `15G` represents logical size and grows as data is written or changed.
1010

1111
## Image/bootstrap workflow
1212

@@ -44,7 +44,7 @@ To force a full rebuild from OCI:
4444

4545
```bash
4646
rm -f ./slicer-base.img
47-
rm -rf ./kernel/slicer ./kernel/sbox
47+
rm -rf ./kernel
4848
rm -rf ./oci-cache
4949
```
5050

@@ -58,6 +58,14 @@ rm -f ./slicer-1.img
5858

5959
If your VM crashes for some reason, or the Mac's sleep mode causes an issue with the VM, you may find the `.img` file needs to be checked or repaired with the `e2fsck` utility.
6060

61+
Check the filesystem (read-only, no changes):
62+
63+
```bash
64+
e2fsck -v -n ./slicer-1.img
65+
```
66+
67+
If errors are found, repair them:
68+
6169
```bash
6270
e2fsck -f ./slicer-1.img
6371
```

docs/reference/networking.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,20 @@ Table of contents:
1111
* [Firewall](#firewall)
1212
* [Additional configuration for Netplan](#additional-configuration-for-netplan)
1313

14-
Both Firecracker and Cloud Hypervisor microVMs use TAP devices for networking. A Linux TAP operates at Layer 2 (Data Link Layer), one end is attached to the microVM, and the other end is attached to the host system.
14+
The Firecracker, QEMU, and Cloud Hypervisors use TAP devices for networking. A Linux TAP operates at Layer 2 (Data Link Layer), one end is attached to the microVM, and the other end is attached to the host system.
1515

1616
Slicer supports multiple networking modes for microVMs, each with their own pros and cons. Generally, you should use the default option (Bridge Networking) unless you have specific requirements that need a different mode.
1717

1818
See `slicer new --help` to generate a Slicer config with bridge-based networking. You can also provide a CIDR block to allocate IP addresses from, if you need to run Slicer across different machines and have them all be routable on the local network.
1919

20+
How do you pick?
21+
22+
* Bridge networking is the default - use it when you want to get started. It lets VMs talk to each other, so it's ideal for K3s where nodes need direct IP to IP access. The host can ingress to VMs via their IP.
23+
24+
* Isolated networking is best when you're running appliances that are connected to the Internet, and can run untrusted workloads, or for other multi-tenant services. You can block VMs from egressing to specific IPs or entire CIDRs like your LAN i.e. `192.168.0.0/24`. There is no ingress available other via `slicer forward` or via network tunnels such as [Inlets](https://inlets.dev).
25+
26+
* CNI mode is generally not recommended or required, but enables additional networking modes, and shares a single pool of IPs across all Slicer daemons running in this mode.
27+
2028
## Bridge Networking
2129

2230
The default for Slicer is to use create a Linux bridge per Slicer daemon, and to attach all microVMs within that hostgroup to the bridge. This allows microVMs to communicate with each other and with the host system.
@@ -82,7 +90,6 @@ Cons:
8290
* microVMs can communicate with the host, and the rest of the LAN, which may not be desirable in some use-cases
8391
* May also have learning delays like the bridge mode
8492

85-
8693
Example:
8794

8895
```yaml

0 commit comments

Comments
 (0)