DevOps Deployment Workflow
In a traditional DevOps pipeline, the CI server (e.g., Jenkins, GitLab CI, CircleCI) handles both build and deployment:-
Commit & Build
- A developer pushes code to a Git repository.
- The CI server runs unit tests, builds the application, and packages it into a Docker image.
-
Push Image
- The image is tagged (e.g.,
repo/app:v1.2.3) and pushed to a container registry (Docker Hub, ECR, GCR).
- The image is tagged (e.g.,
-
Deploy to Kubernetes
- The same CI pipeline uses stored Kubernetes credentials to apply manifests directly:
Challenges in DevOps Deployment
| Challenge | Impact |
|---|---|
| Cluster credentials in CI | Security risk if credentials are leaked or compromised. |
| CI tool coupling | Migrating to another CI/CD system requires rewriting deployment logic. |
| Limited auditability | Harder to track “who changed what” outside Git history. |
Storing Kubernetes credentials in your CI/CD server can expose your cluster if the server is compromised.
GitOps Deployment Workflow
GitOps decouples build from deploy by introducing an in-cluster agent (often called an operator) that continuously reconciles Git state with the live cluster.Common CI Steps (Same as DevOps)
- Developer commits code.
- CI server builds, tests, and pushes the Docker image to the registry.
Deployment Options
- Agent watches registry tags or watches the Git repo directly.
- On detecting a new tag, agent updates or pulls manifests and applies changes. | | B | 1. Extend CI pipeline to clone the manifests repo.
- CI updates
deployment.yamlwith the new image tag:
- CI opens a Pull Request against the manifest repository.
- After review & merge, the in-cluster agent pulls and applies the updated manifests. |
In both options, the CI server never needs direct access to Kubernetes. All deployment actions are driven by Git operations.
Key Benefits of GitOps
| Feature | DevOps | GitOps |
|---|---|---|
| Source of Truth | CI/CD tool + Git | Git repository only |
| Cluster Credential Scope | Stored in CI server | Only the in-cluster agent has access |
| Audit & Rollback | Custom scripts & logs | Git history and simple git revert |
| Tool Coupling | CI/CD-specific | Any Git-compatible workflow |
| Security & Compliance | Broader attack surface | Reduced credentials exposure, easier policy enforcement |