DevOps Philosophy & Culture
This section explores the methodologies, cultural philosophies, and practices of DevOps, including the Three Ways, CI/CD theory, and DORA metrics (e.g., notes from The Phoenix Project or The DevOps Handbook).
Imperative vs. Declarative Systems
A core cultural shift in DevOps is moving from Imperative infrastructure management to Declarative Infrastructure as Code (IaC).
Imperative (The "How")
Imperative systems require you to define the exact sequence of steps to achieve a goal.
- Example: Bash scripting (
apt-get install nginx,systemctl start nginx). - Drawback: It is brittle. If you run the script and
nginxis already installed but in a broken state, the script might fail or ignore the broken state. The script focuses on actions, not outcomes.
Declarative (The "What")
Declarative systems require you to define the desired end state, and the system figures out the steps required to get there.
- Example: Ansible, Terraform, or Kubernetes YAML (
state: present,replicas: 3). - Advantage: Focuses on the outcome. The tool calculates the "diff" between the current state and the desired state, and only takes action if necessary.
Idempotency
The superpower of declarative systems is Idempotency: the property that an operation can be applied multiple times without changing the result beyond the initial application. You can safely run an Ansible playbook every 10 minutes; if the system is already in the correct state, it simply reports ok and does nothing, preventing configuration drift.