Chaos Mesh in the pod e2e cluster
Real Chaos Mesh runs in the pod e2e minikube
cluster, and the harness (test/e2e/pods) has primitives to create, observe
and remove experiments against the real Urutau coordinator/worker Pods. This
page covers that foundation only: install, the harness API, and its one sharp
edge. Randomized scheduling of overlapping faults — which chaos type, which
target, when, how long — is the chaos controller, documented under
Production-readiness workload.
Fault injection through this path must be a real Chaos Mesh resource acting
on the real MySQL → Iceberg pipeline, never deletePod or in-process
goroutine control standing in for it.
Install
test/e2e/pods/up.sh installs Chaos Mesh the same way it installs every
other e2e cluster add-on (cert-manager, KEDA): pin a version, apply, wait for
Available. Left installed across down.sh teardown, same as cert-manager
and KEDA — it is a slow-to-reinstall cluster add-on, not per-run state.
Chaos Mesh's only supported install path is Helm; there is no pinned
single-file manifest upstream the way there is for cert-manager and KEDA. To
keep up.sh's "kubectl + minikube only" contract, test/e2e/pods/k8s/chaos-mesh/manifest.yaml
is a one-time static render of the chart (dashboard disabled — the harness
drives everything through kubectl, not the web UI). The file's header
documents the exact helm template invocation to regenerate it on a version
bump.
Several of its CRDs (schedules, workflows, workflownodes) exceed the
client-side last-applied-configuration annotation size limit — the same
problem KEDA's CRDs hit — so the install uses kubectl apply --server-side --force-conflicts, not a plain apply -f.
Harness primitives (test/e2e/pods/chaos_mesh_test.go)
Thin, kubectl-based wrappers, matching the shell-out style of the rest of the harness (no client-go/controller-runtime dependency):
| Function | Purpose |
|---|---|
verifyChaosMeshReady | Asserts the controller manager and daemon are Ready. Fails the test hard if Chaos Mesh is missing or broken — chaos must never be silently skipped. |
applyPodChaos | Creates a PodChaos (pod-kill or pod-failure) targeting pods by label selector. |
applyNetworkChaos | Creates a NetworkChaos between a selector and a target selector (e.g. worker ↔ coordinator). |
applyStressChaos | Creates a StressChaos (cpu or memory) targeting pods by label selector. |
waitChaosExperimentInjected | Polls the AllInjected condition — the fault took effect. Works for every chaos kind. |
waitChaosExperimentStopped | Polls .status.experiment.desiredPhase for Stop — Chaos Mesh's own terminal value once a duration-bound experiment's duration elapses. |
deleteChaosExperiment | Removes the experiment CR, best-effort — safe from t.Cleanup. |
Targets are the same coordinator/worker label selectors the rest of the
harness already uses (deletePod, workerSTSs):
| Target | Selector |
|---|---|
| A pipeline's coordinator | app=urutau-coordinator,urutau.io/pipeline=<name> |
| All of a pipeline's workers | app=urutau-worker,urutau.io/pipeline=<name> |
| One table's worker StatefulSet | urutau.io/worker=<pipeline>-<target> |
Namespace: pod-e2e (the harness's testNS), alongside the CDCPipeline the
experiment targets.
desiredPhase only has two values: Run and Stop
There is no Finished value anywhere in Chaos Mesh's status — the CRD's
desiredPhase enum is exactly Run and Stop. A duration-bound experiment
(pod-failure, NetworkChaos, StressChaos) moves from Run to Stop
once its duration elapses; waitChaosExperimentStopped polls for that.
PodChaos with action: pod-kill is different: it is continuous, not
duration-bound, so it never leaves Run — Chaos Mesh reapplies the kill to
any new pod matching the selector until the CR is deleted.
waitChaosExperimentStopped hangs on it forever. Use
waitChaosExperimentInjected (the AllInjected condition) instead, which
works for every chaos kind, then delete the experiment once the kill has
been observed.
pod-kill also deletes the Pod object outright, the same as the harness's
own deletePod — the owning StatefulSet recreates it as a new Pod with the
same ordinal name but a new UID. restartCount stays 0 on the recreated
Pod (it is a new object, not a restarted container), so it cannot prove the
kill happened. Compare metadata.uid before and after instead — that is how
TestChaosMeshPodKillAffectsRealPipeline (chaos_mesh_smoke_test.go) proves
Chaos Mesh, not the test process, did the killing.
chaosDaemon.runtime must match the cluster's actual runtime
The vendored manifest leaves chaosDaemon.runtime at the chart's default
(docker, /var/run/docker.sock). An earlier revision pinned it to
containerd, on the assumption that's minikube's default — it silently
broke NetworkChaos: the daemon could apply PodChaos pod-kill fine (it
only needs the Kubernetes API), but every NetworkChaos/StressChaos
injection failed with unable to flush ip sets ... expected containerd:// but got docker://..., because minikube's default driver here runs
Kubernetes under dockerd. Verify NetworkChaos/StressChaos specifically
after touching this setting — PodChaos pod-kill passing is not enough
signal that the runtime is configured correctly.