Shift-Left Resilience: Chaos in Your CI/CD Pipeline
Think of it as an automated stress test in your build pipeline that breaks things on purpose. It runs alongside integration tests, injecting faults like pod failures to find weaknesses before a merge.
Why it exists
Modern distributed systems fail in complex ways. Waiting for production outages to discover weaknesses is expensive and reactive. Integrating chaos experiments into the CI/CD pipeline allows teams to find and fix resilience issues proactively, just like they do with bugs and security vulnerabilities, before the code ever reaches production.
The mental model
Think of your CI/CD pipeline as an assembly line for software. You have quality checks for bugs (unit tests) and performance (load tests). Automated chaos experiments add a new quality gate: a "shake table" test. Before a feature is shipped, the pipeline automatically puts it on the shake table, simulating real-world turbulence like network failures or resource exhaustion, to ensure it doesn't fall apart.
How it works
When a CI/CD pipeline runs, a chaos engineering tool is triggered, often after a successful deployment to a staging or testing environment. The tool injects a pre-defined, controlled fault from a library—for example, killing a Kubernetes pod or adding latency to a service. During the fault injection, "probes" continuously monitor the system's health and application-level SLOs. If the system remains stable and meets its objectives despite the chaos, the experiment passes. If it degrades unacceptably, the experiment fails, and the pipeline can be configured to block the promotion to production.
When to use it
Use this when you want to build confidence that your application can handle partial failures gracefully. It's ideal for microservices architectures where dependencies can fail. Integrate it into your CI/CD process to automatically verify the resilience of new features, test the effectiveness of your alerting, and ensure failover mechanisms work as expected before they are needed in a real incident.
When not to use it
Don't run chaos experiments in CI/CD without a stable, isolated test environment; you risk disrupting other developers and tests. Avoid it if your system lacks robust monitoring and observability ("probes"), as you won't be able to determine the impact or validate success. It's also premature if the team hasn't already embraced a culture of learning from failure.
One canonical example
A development team builds a new checkout service. As part of their CI/CD pipeline, after deploying to staging, a chaos experiment automatically runs. It injects 200ms of latency into the dependency call to the payment processor. Simultaneously, a Gatling performance test simulates user traffic. A probe monitors the checkout service's success rate. If the rate drops below 99.5% during the latency injection, the experiment fails, the pipeline halts, and the build is marked as failed, preventing the fragile code from being promoted.
Interview question
What is the core objective of integrating chaos experiments into a CI/CD pipeline for shift-left resilience?
- a.To confirm that all service dependencies are correctly configured and operational in a staging environment.
- b.To proactively uncover and address system vulnerabilities to controlled failure scenarios before production.Correct
- c.To guarantee that all new features meet performance benchmarks under peak traffic.
- d.To automatically roll back deployments that introduce new bugs or regressions.
Why? this is the answer
The card explicitly states that shift-left chaos engineering aims to "find and fix resilience issues proactively" by simulating real-world turbulence. While performance testing (option C) is important, chaos experiments specifically test system behavior under controlled failure conditions, not just peak load.
Just read this? Test yourself on what you have been reading.
Read the original → developer.harness.io
- #chaos engineering
- #sre
- #ci/cd
- #resilience
- #testing
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles