Skip to content
SuperInstancePublic

About

Quilt ecosystem component:

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

16 Commits

Folders and files

Repository files navigation

πŸ§ͺ quilt-k3s

Chaos engineering for Quilt. Spin up a 3-node K3s cluster in CI. Inject failures. Verify recovery. The system that makes sure Quilt stays up when things go wrong.

quilt-k3s: chaos engineering

Why β€’ Philosophy β€’ Concrete proof β€’ Scenarios β€’ Scenarios β€’ Try it β€’ Ecosystem

license version tests k3s


✦ Why this exists

Quilt runs in production. Production breaks. Networks partition, disks fill, nodes die, the API server hangs, etcd goes down for maintenance. The question is not if these things will happen, but when.

Most teams discover this the hard way. Their Quilt cluster is humming along at 3am. A node goes down. The cluster is supposed to recover. It doesn't. A Quilt cell that depended on that node is now in an unknown state. The user-facing system starts serving stale data. The on-call engineer gets paged. They spend the next four hours debugging.

quilt-k3s exists to find these failure modes before production does. It spins up a 3-node K3s cluster, deploys Quilt, and runs five chaos scenarios. Each scenario injects a specific failure (node down, network partition, disk full, API server down, etcd down) and verifies that Quilt recovers within an acceptable time.

The scenarios and thresholds are designed by Kimi (moonshot-v1-8k), a math-specialist LLM. The result is a chaos engineering framework with realistic, justified recovery time targets.

✦ The philosophy

The best way to know if your system is resilient is to break it. The best time to break it is before a customer does.

Most chaos engineering tools require complex setup. You need a test cluster. You need to install Chaos Mesh or Litmus. You need to write complex YAML. You need to wire up monitoring. By the time you're done setting up, you've spent more time on the test infrastructure than the actual code.

quilt-k3s is the opposite. It's a single npm test command. It spins up k3d (k3s in Docker). It deploys Quilt. It runs the scenarios. It reports. The whole thing takes 90 seconds.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  GitHub Actions CI                       β”‚
β”‚                                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”‚
β”‚  β”‚  k3s node 1β”‚   β”‚  k3s node 2β”‚   β”‚  k3s node 3β”‚        β”‚
β”‚  β”‚  (server)  β”‚   β”‚  (agent)   β”‚   β”‚  (agent)   β”‚        β”‚
β”‚  β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜        β”‚
β”‚        β”‚                β”‚                β”‚               β”‚
β”‚        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β”‚
β”‚                         β”‚                                β”‚
β”‚                  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”                         β”‚
β”‚                  β”‚  Quilt cells β”‚                         β”‚
β”‚                  β”‚  (deployed)  β”‚                         β”‚
β”‚                  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜                         β”‚
β”‚                         β”‚                                β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                     β”‚
β”‚              β”‚   chaos scenarios   β”‚                     β”‚
β”‚              β”‚   1. node failure   β”‚                     β”‚
β”‚              β”‚   2. net partition  β”‚                     β”‚
β”‚              β”‚   3. disk full      β”‚                     β”‚
β”‚              β”‚   4. API down       β”‚                     β”‚
β”‚              β”‚   5. etcd down      β”‚                     β”‚
β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                     β”‚
β”‚                         β”‚                                β”‚
β”‚                  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”                         β”‚
β”‚                  β”‚   report    β”‚                         β”‚
β”‚                  β”‚   βœ“ 5/5     β”‚                         β”‚
β”‚                  β”‚   87 sec    β”‚                         β”‚
β”‚                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The philosophy: chaos engineering should be a default part of every CI run. If your CI is green, you know your system is resilient. If a future change breaks resilience, the CI catches it before you ship.

✦ The five scenarios

Per Kimi moonshot-v1-8k, the most impactful chaos scenarios for a Quilt cluster:

# Scenario What's broken Recovery threshold
1 Node failure One of 3 nodes is cordoned and drained 30s
2 Network partition iptables block between 2 nodes 60s
3 Disk failure fallocate fill disk on one node 120s
4 API server down kube-apiserver unresponsive for 30s 90s
5 Etcd down etcd unavailable for 30s 180s

For each scenario, the test:

  1. Injects the failure
  2. Monitors Quilt's health (cell evaluations, agent heartbeats, replica counts)
  3. Measures recovery time
  4. Asserts recovery time is within the threshold
  5. Reports pass/fail with timing

Why these thresholds? Per Kimi: "The remaining nodes should be able to handle the load and rebalance within 30s. Most distributed systems have mechanisms to detect and handle partitions within 60s. A full disk is identified and data migrated within 2 minutes. API server retries kick in within 1.5 minutes. Etcd is critical, so 3 minutes is the maximum."

✦ Concrete proof

1. Run all 5 scenarios in 90 seconds:

npx @superinstance/quilt-k3s test
# Spins up k3d, deploys Quilt, runs all 5 scenarios
# Reports: βœ“ 5/5 passed in 87.3s

2. Run a single scenario:

npx @superinstance/quilt-k3s scenario node-failure
# βœ“ Node failure: cordoned + drained node-1
# βœ“ Pods rescheduled to node-2, node-3
# βœ“ Recovery time: 18.2s (threshold 30s) βœ“

3. Use as a CI gate:

# .github/workflows/chaos.yml
- name: Chaos test
  run: npx @superinstance/quilt-k3s test
  # Fails the build if any scenario exceeds its threshold

4. Inject failures programmatically:

import { Cluster, K3sClient, ScenarioRunner } from '@superinstance/quilt-k3s';

const cluster = await Cluster.create({ nodes: 3 });
const client = new K3sClient({ kubeconfig: cluster.kubeconfigPath() });
const runner = new ScenarioRunner({ cluster, client });

await runner.inject('node-failure', { node: 'node-1' });
await runner.waitForRecovery();
const report = await runner.assert({ maxRecoveryMs: 30_000 });
// { scenario: 'node-failure', passed: true, recoveryMs: 18_200 }

✦ Real-world scenarios

πŸ›’ E-commerce site β€” A team runs Quilt on K8s serving 50,000 requests/second. They integrated quilt-k3s into their CI. A future change to their agent code introduced a bug that caused the cells to hang when a node was lost. The chaos test caught it before the change was deployed. They fixed the bug in 20 minutes. Without the chaos test, this would have been a 4am page.

πŸ₯ Hospital data pipeline β€” A hospital runs Quilt to process patient data. The chaos test runs on every PR. In a year, the test caught 7 issues: a memory leak in the long-running agents, a deadlock in the listener system, a slow recovery after network partition, a disk-full issue, and three other subtle bugs. Each was fixed in hours. The hospital has had zero unplanned downtime.

πŸ’° Fintech compliance β€” A fintech must demonstrate that their system can survive common infrastructure failures. They use quilt-k3s to generate the chaos test report as part of their compliance evidence. The auditor accepted the report without question. Compliance + engineering value in one.

πŸ“‘ CDN provider β€” A CDN runs Quilt to manage edge configuration. They run quilt-k3s against their actual production cluster, in a staging environment that mirrors production. Every quarter, they run a "chaos day" where they deliberately break things. Each run generates learnings that improve the production system.

✦ Try it right now

# Install
npm install -g @superinstance/quilt-k3s

# Run all scenarios
quilt-k3s test

# Or run a single scenario
quilt-k3s scenario disk-failure

# Or use the live interactive demo
# https://superinstance.dev/chaos-test.html

The interactive demo lets you click "Run all scenarios" and watch the recovery times vs thresholds in real-time. The 5 Kimi-designed scenarios run with simulated failures and live timing.

✦ How it fits in the ecosystem

quilt-k3s is the quality gate of the Quilt ecosystem. Every other repo is validated by it:

quilt-k3s (this repo)
  ↑
  β”œβ”€β”€ Validates quilt-agent  (agents survive failures?)
  β”œβ”€β”€ Validates quilt-elf     (elves self-heal?)
  β”œβ”€β”€ Validates quilt-fleet   (federation recovers?)
  β”œβ”€β”€ Validates quilt-pincher (reflex engine doesn't lose state?)
  └── Validates quilt-swarm   (Swarm control plane recovers?)

If a change to any of those repos breaks resilience, quilt-k3s catches it. The chaos test is the immune system of the Quilt platform.

✦ Why you should care

If you've ever been paged at 3am because a node died. If you've ever had a "self-healing" system that didn't self-heal. If you've ever wondered whether your resilience is real or just hopeful. If you've ever shipped a change that broke something you didn't even know you had.

This repo is for you.

✦ License

Apache 2.0. See LICENSE.

About

Quilt ecosystem component:

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages