What Is A Feature Flag In DevOps?
A feature flag is a switch that turns a feature on or off without requiring a new deployment. It allows teams to separate code deployment from feature release.
In DevOps, feature flags help reduce risk because new code can be deployed quietly, tested with limited users, disabled quickly, or rolled out gradually.
The core idea is control. Instead of making every deployment a big public event, the team can control who sees what and when.
DevOps Production Playbook
Use this section to understand where the concept fits in a real software delivery system: pipeline stage, production risk, detection signals, rollback, security, and big-company standard.
Teams need to release features gradually and disable risky behavior without redeploying code.
A feature flag is a runtime switch. It lets the team deploy code separately from exposing the feature to users.
A new checkout flow is deployed but hidden behind a flag. It is enabled for internal users first, then 5 percent of users, then disabled when errors increase.
Feature flag service, config store, rollout percentage, user segment, kill switch, experiment control, application config.
grep -R 'feature_flag' .; curl https://example.com/health; kubectl set env deployment/app NEW_CHECKOUT=false; git diff
Release control: deploy hidden code -> enable for small group -> monitor -> expand rollout -> disable quickly if risk appears
Old flags never removed, flag logic too complex, no owner, flag default wrong, flag state different across environments, hidden dependency.
Error rate increases only for flagged users, logs show feature path failure, conversion drops after flag enable, support tickets mention new flow.
Feature flags can reduce change failure damage and recovery time because risky behavior can be disabled quickly.
Turn off the flag, verify metrics recover, keep deployment stable, investigate logs, fix code, retest with limited rollout.
Protect admin access to flags. Audit flag changes. Avoid exposing secret behavior through client-side flags. Use least privilege.
A big company expects flag ownership, audit history, cleanup process, rollout rules, kill switch, and monitoring by segment.
Create a simple feature flag using an environment variable. Run the app with the feature on and off without changing code.
What problem do feature flags solve? How are feature flags different from branches?
Using flags as permanent code clutter, no cleanup, enabling for everyone at once, allowing anyone to change production flags.
Separate deployment from exposure. This principle applies to software features, infrastructure changes, AI models, pricing pages, and SEO experiments.