
kubectl. These ad-hoc edits, often made under time pressure, create a fragmented change history and reduce visibility:
- No central record of changes, authors, or timestamps.
- Conflicting or overlapping edits from multiple teams.
- Harder root-cause analysis, longer outages, and fragile recovery procedures.

- Version history and timestamps
- Commit authorship for auditability
- Simple rollback by reverting commits


Pull-based GitOps improves security posture: controllers running inside the cluster (with scoped credentials) fetch declarative manifests from Git. CI systems don’t need permanent cluster admin credentials to deploy changes.
- Code & push: Developers change manifests and push commits to Git.
- Watch / Detect: The GitOps controller (e.g., Argo CD or Flux) sees the change via webhook or polling.
- Compare: The controller diffs the desired state in Git against the live cluster, resource-by-resource.
- Sync / Apply: If differences exist, the controller creates the necessary create/update/delete operations to converge the cluster to Git.

- You update a Deployment manifest to change an image tag from
v1.0tov2.0and push the commit to Git. - The controller detects the commit (webhook or polling) and diffs the live Deployment.
- The image mismatch is found; the controller updates the Deployment to
v2.0. - No human intervention is required; the controller continuously enforces the declared state.
-
Auto-sync (self-healing)
- The controller automatically reverts out-of-band changes to match Git. This strictly enforces Git-as-source-of-truth and reduces long-lived divergence.
-
Alert + manual sync
- The controller detects drift and alerts operators. A human inspects and triggers a sync if appropriate — useful in environments with strict change control.
-
Diff + PR workflow
- If an intentional change was made directly in the cluster, the controller can create a pull request to update Git, preserving the intentional change while keeping Git authoritative.
Auto-sync can unintentionally overwrite emergency fixes applied directly to the cluster. If you use auto-sync, implement safeguards (alerts, maintenance windows, or temporary disabling) to avoid losing critical incident work.

The guiding principle remains: either reconcile the cluster to Git, or update Git with intentional, approved cluster changes.

- Treat Git as the single source of truth: all desired state should live in version-controlled repositories.
- Prefer the declarative model over imperative commands: describe what you want, and let automation handle how to get there.
- Use continuous reconciliation to prevent and correct drift.
- Pull-based controllers improve security by minimizing the need for external systems to hold cluster credentials.

- Git official site
- kubectl reference
- Argo CD documentation
- Flux project
- Kubernetes Horizontal Pod Autoscaler (HPA)
- Vertical Pod Autoscaler (VPA)