Repository navigation
Description
Kiri version and system
Kiri 0.2.2 (engine 0.2.2), macOS 27.2.1, Apple M1 Max (10 cores, 64 GB), Apple silicon.
Guest: Linux 6.18.58 (Kiri's own kernel). VM: {"cpus":6,"memory_mib":24576}.
KIRI_NO_BALLOON=1 is set — that's the workaround for #646/#891, which is why Balloon below reads 0. To keep balloon out of the picture: with the balloon disabled, the burn still appears and disappears with the cluster alone (kiri k8s stop → 0.1–0.3%, kiri k8s start → back), so it tracks the cluster rather than the balloon setting, and this is not a recurrence of the #646/#988 balloon loop. I have not measured with the balloon enabled.
Nothing else is running: the only container is Kiri's own kiri-k8s (rancher/k3s:v1.37.1-k3s1), the cluster is empty apart from kube-system, pods total 8m CPU and kubectl top node reports 82m.
What you did
kiri k8s start # "Kubernetes is ready in 2 s"
# leave it completely idle, then sample the Virtualization VM process:
ps -o time= -p <vm pid>; sleep 8; ps -o time= -p <vm pid> # 8 s window, %CPU = delta/8
A/B with the same VM process pid:
kiri k8s stop # VM process drops to 0.1–0.3%
docker run -d --name probe busybox sleep 300 # stays at 0.2% while the cluster is off
kiri k8s start # the burn comes back
What happened
With the cluster up and nothing running, com.apple.Virtualization.VirtualMachine holds 88–107% of one core indefinitely (8 s ps -o time deltas, repeated over about two hours: 88.0, 93.6, 98.1, 101.4, 103.3, 104.0, 106.8, 107.5).
kiri k8s stop→ 0.1–0.3% within seconds; the container isExited (0)and stays that way across daemon restarts (RestartPolicyisunless-stopped).kiri k8s start→ it ramps back: 12.5% over an 8 s window right after start, then ~100% after a few minutes. So "start and measure immediately" under-reports it.- An ordinary long-running container does not trigger it (
docker run -d busybox sleep 300with the cluster stopped: 0.2%). - The daemon itself is 0% in steady state (verified with
ps -o timedeltas;ps %cpuis a lifetime average and misleading here). - It survives
launchctl kickstart -kof the daemon and VM sleep/wake, so it isn't a macOS: engine API deadlocks after a daemon restart: create/info/exec hang forever behind a VmLink request with no reply #948-style leftover.
Where the CPU goes, with the cluster up and idle:
- Guest
/proc/stat: ~10–11% busy across the 6 vCPUs, spread out per CPU (2–34%) — no vCPU is accounted busy. - Guest
/proc/softirqs, deltas over 6 s:TIMER +719,SCHED +3109,RCU +2579,NET_RX +413,NET_TX 0. No interrupt or softirq storm. - Guest
/proc/interrupts: 0 lines (the shipped kernel does no per-IRQ accounting), so I couldn't attribute it to an IRQ. - No cpuidle driver:
/sys/devices/system/cpu/cpu0/cpuidledoes not exist and/sys/devices/system/cpu/cpuidle/current_driveris empty. - On the host,
sampleof the VM process puts 1371 of 1473 samples ofcom.apple.virtualization.thread.cpu-0inhv_trap/Hv::Vcpu::run(): the guest really is executing instructions, while Linux counts that time as idle.
My reading is that a vCPU keeps taking exits in the guest's idle path only while the cluster is up (k3s brings a lot of netns/veth/iptables/conntrack and timers with it). That part is an inference, not a measurement — the counters above can't attribute it to a process or an IRQ.
What you expected instead
An idle VM sits near 0% on the host, the way it does with the cluster stopped (kiri k8s stop gives 0.1–0.3%), and the way it does with any other container running.
Anything else
Reproducible every time on this machine. I first noticed it on 0.2.2, after setting {"cpus":4,"memory_mib":16384}; it also shows at 6 vCPUs / 24 GiB. I have no 0.2.1 measurement to compare against.
Workaround for now: kiri k8s stop when the cluster isn't needed (it starts again in 1–2 s, ~20 s cold). That's fine for me, but it means a cluster left on all day costs a whole core.
Happy to run a build from a branch and send whatever measurements help. A kernel with per-IRQ accounting (/proc/interrupts) or perf in the guest would make this attributable, if you want it narrowed to the vGIC/vtimer vs virtio-net side before touching anything.
Activity
Engine & CLI: restore missing unpacked layers, fix macOS k8s idle CPU (…
libracoder commentedon Nov 27, 2026
Fixed in #996 (
31cca962):/Usersand/Volumesonkiri-k8s: Excluded thedev.kiri.k8snode container frommac_bind_sources()(andwsl_bind_sources()on Windows) sokiri-k8s's/Usersand/VolumeshostPathmounts no longer open a 50 msFSEventsstream across the entire Mac filesystem or wake vCPU 0 on host background file writes.k3sbackground tickers (timerslack_ns = 10 ms): Applied10 mstimer coalescing tokiri-k8sacrossexecve, coalescingk3s's dozens of staggered100 mswatch_progress/kine/cAdvisortimers and cuttingarch_timerand cross-vCPUIPI1interrupts by 60–72% (especially impactful on Apple Silicon software-emulated vGIC).kubectl get svc -Apolling spawn loop with a persistentkubectl get svc -A --watch-onlystream.This will ship in the upcoming
0.2.3release.Engine & CLI: restore missing unpacked layers, fix macOS k8s idle CPU (…