Overview
Curated: · Written: · Reviewed:
Configuration Management
In one line
Keeping infrastructure and application configuration consistent, versioned and reproducible: a reviewed desired state, a mechanism that converges reality to it, and a way to see when it cannot. Reach for it when the same settings must hold across many hosts or environments and the risk is drift or an unreviewed change.
Key definitions
- Desired state: the reviewed, versioned description of how a thing should be.
- Convergence: the provider compares observed state with declared state and applies only the difference.
- Idempotency: a run with no input change makes no change. It is a property of the resource implementation and environment, not of the tool.
- Drift: a difference between authorized intended state and observed relevant state. An approved dev/prod difference is not drift.
- Ownership: which actor may write a given attribute. Two writers on one attribute will fight.
- Reload vs restart: a reload re-reads config in place; a restart drops in-flight work.
How it works
- Represent intended state as reviewed artifacts in version control; promote by reference, not by per-environment branches.
- Validate schema, allowed values, cross-field rules and rendered output before any apply.
- Converge each resource. It reports changed only when it actually acted, so a re-run of unchanged input is a no-op.
- Verify service behaviour, not the exit code. Notify dependents only on real change, and coalesce notifications into one reload.
- Detect divergence by scheduled audit or continuous reconciliation, classify it, then remediate or reconcile back to source.
When to use and when not to
| Factor | Push (Ansible over SSH or WinRM) | Pull agent (Chef, Puppet, Salt) |
|---|---|---|
| Bootstrapping | Reachable credentials only | Agent install and upgrade across the fleet |
| Network reach | Control node must reach every target each run | Hosts fetch from the server, so NAT is fine |
| Convergence cadence | Whenever you run it | Fixed schedule, for example every 30 minutes |
| Disconnected hosts | Fall behind until reachable | Converge on next successful check-in |
| Lifecycle risk | Few moving parts on targets | Agent becomes a foothold and a version to manage |
Do not use CM to create cloud resources. Terraform or the cloud API owns lifecycle (database instance, subnet, managed service); CM configures what runs on top. Decide by fleet size, network topology and how fast an emergency change must reach every host.
Traps interviewers probe
- Calling a command or shell task idempotent. Fix: add creates or removes guards, or a durable marker tied to the desired version, then verify the resulting state.
- Stamping non-behavioural content into a hashed artifact, so every build changes the hash. Example: a generated build-info.json inside a Lambda zip changes source_code_hash on every merge. Fix: hash only the inputs that define behaviour and keep build metadata out of the hashed artifact.
- Two controllers writing one field. Example: an HPA scaling replicas while a GitOps reconciler resets replicas to the manifest value every 30 seconds. Fix: give each field one owner; remove the field from the manifest the other controller manages, or configure the reconciler to ignore it.
- Trusting a successful run. A health check that registers 500 without failing the play, or a pipeline without pipefail that reports exit 0 on a truncated dump. Fix: fail on the status you need, set pipefail, and verify the end state.
- Silent defaults and reloads. A missing variable falls back to a built-in default, and a value that passes the schema (max_conns 0) can still break the daemon. Fix: require values that matter, validate semantics the schema misses, and gate reloads on that check. Note that a subPath ConfigMap mount never receives updates, so the pod must restart to see a change.
Interview tips
Open by naming the intended state, how it converges and how you detect divergence, in one sentence.
Follow-ups to expect:
- Re-run this playbook twice. Name which resources report changed on the second run and which cannot be re-checked, and the guard that fixes it.
- An operator hand-edited a prod file during an incident. Classify the drift, preserve the evidence, and reconcile the mitigation into review if it was correct.
- Where do secrets live? Trace store to process environment, who can decrypt, and how rotation reaches the workload. Base64 is encoding, not encryption.
- Roll back the last change. Ask about reversibility first; prefer forward repair when a schema, password or certificate change cannot be undone.
- How do you know the fleet is compliant? Count only reports fresher than the check-in interval, and sample independently, because a dead agent looks healthy in its own dashboard.
30-second outline:
- Intended state lives in reviewed Git and is promoted by reference.
- Each resource converges to declared state; unchanged input reports no change.
- Imperative steps get guards and a post-check on behaviour.
- Drift is sampled independently, classified, and reconciled into source rather than blindly overwritten.
- Rollout runs in cohorts across failure domains, with a rollback chosen by change reversibility.
Feedback on this overview
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.