What Is A Feature Flag In DevOps?

halfbrain_logo512adminJune 21, 2026
0 lượt xem

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.

Release EngineeringRelease
Core Problem

Teams need to release features gradually and disable risky behavior without redeploying code.

Mental Model

A feature flag is a runtime switch. It lets the team deploy code separately from exposing the feature to users.

Production Scenario

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.

Tooling Context

Feature flag service, config store, rollout percentage, user segment, kill switch, experiment control, application config.

Command Examples

grep -R 'feature_flag' .; curl https://example.com/health; kubectl set env deployment/app NEW_CHECKOUT=false; git diff

Config Example

Release control: deploy hidden code -> enable for small group -> monitor -> expand rollout -> disable quickly if risk appears

Failure Modes

Old flags never removed, flag logic too complex, no owner, flag default wrong, flag state different across environments, hidden dependency.

Detection Signals
DORA Impact

Feature flags can reduce change failure damage and recovery time because risky behavior can be disabled quickly.

Rollback Plan

Turn off the flag, verify metrics recover, keep deployment stable, investigate logs, fix code, retest with limited rollout.

Security Check

Protect admin access to flags. Audit flag changes. Avoid exposing secret behavior through client-side flags. Use least privilege.

Big Company Standard

A big company expects flag ownership, audit history, cleanup process, rollout rules, kill switch, and monitoring by segment.

Lab Task

Create a simple feature flag using an environment variable. Run the app with the feature on and off without changing code.

Interview Angle

What problem do feature flags solve? How are feature flags different from branches?

Common Mistakes

Using flags as permanent code clutter, no cleanup, enabling for everyone at once, allowing anyone to change production flags.

Transferable Principle

Separate deployment from exposure. This principle applies to software features, infrastructure changes, AI models, pricing pages, and SEO experiments.

Share:

Disclaimer: The guides, checklists, commands, and examples on HalfBrain.net are provided for educational and operational reference only. Server environments, hosting providers, software versions, security settings, and WordPress configurations can vary, so you should always review commands before running them on your own system. We do our best to keep the content accurate and useful, but we cannot guarantee that every command, configuration, or recommendation will fit every environment. Always back up your website, database, and server configuration before making changes. HalfBrain.net is not responsible for data loss, downtime, security incidents, misconfiguration, or other issues that may result from applying the information on this website. Use the material at your own discretion.

Leave a Reply

Your email address will not be published. Required fields are marked *