This guide explains how to build a practical DevOps pipeline using Docker, GitHub Actions, Terraform, Kubernetes, GitOps, and OpenTelemetry. It is written for developers, DevOps engineers, system administrators, technical leads, and IT professionals who want a real implementation path instead of a loose tool list.
What Is a Modern DevOps Pipeline?
A modern DevOps pipeline is an automated workflow that validates, packages, secures, deploys, and monitors an application.
The goal is not just faster deployment. A well-designed pipeline makes releases repeatable, traceable, secure, testable, recoverable, and easy to review. Every production version should be connected to a Git commit, a container image, a deployment record, and an approval history.
Modern DevOps Pipeline Tools
The exact stack depends on your organization, cloud provider, and application architecture, but a practical setup often looks like this:
| Requirement | Common Tools |
|---|---|
| Source control | GitHub, GitLab, or Bitbucket |
| Continuous integration | GitHub Actions, GitLab CI, or Jenkins |
| Containers | Docker |
| Container registry | GHCR, AWS ECR, or Azure Container Registry |
| Infrastructure as Code | Terraform or OpenTofu |
| Container orchestration | Kubernetes |
| GitOps | Argo CD or Flux |
| Image scanning | Trivy |
| Dependency scanning | Dependabot or Snyk |
| Policy enforcement | Kyverno or Open Policy Agent |
| Secrets management | Vault or a cloud secret manager |
| Telemetry | OpenTelemetry |
| Monitoring | Prometheus and Grafana |
| Logs | Loki, Elasticsearch, or a cloud logging service |
Do not choose tools only because they are popular. Choose tools your team can operate, secure, and maintain.
Step 1: Define Your Deployment Environments
Before writing the pipeline, define where the application will run. Most teams need at least development, staging, and production. Staging should resemble production closely enough to validate application behavior and deployment flow safely.
| Environment | Purpose | Deployment Rule |
|---|---|---|
| Development | Individual development and testing | Manual or automatic |
| Staging | Integration and user acceptance testing | Automatic after merge |
| Production | Live customer traffic | Approval required |
Step 2: Containerize the Application
Containers package the application with its runtime and dependencies, which reduces differences between local, staging, and production environments.
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:22-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=builder /app/dist ./dist
EXPOSE 3000
USER node
CMD ["node", "dist/server.js"]
Create a .dockerignore file too:
node_modules
.git
.github
.env
coverage
tests
README.md
Before moving on, verify that the application starts correctly, exposes the right port, excludes development dependencies, does not store secrets in the image, and does not run as root.
Step 3: Create a Continuous Integration Pipeline
A useful CI pipeline should check out the code, install dependencies, run linting and tests, scan for problems, build the container image, and push only approved artifacts.
name: Application CI
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
packages: write
security-events: write
jobs:
test-build-scan:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Configure Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint
- name: Run tests
run: npm test
Use the Git commit SHA as the image tag to create an immutable connection between the source code and the deployed image.
Step 4: Protect the Main Branch
Automation cannot compensate for an uncontrolled source-control process. Protect the main branch and require pull requests, successful automated checks, code review, resolved comments, and up-to-date branches before merging.
Step 5: Provision Infrastructure with Terraform
Infrastructure as Code allows cloud resources to be defined in version-controlled files instead of being created manually through a dashboard.
infrastructure/
|-- environments/
| |-- staging/
| `-- production/
|-- modules/
| |-- network/
| |-- kubernetes/
| |-- database/
| `-- monitoring/
|-- providers.tf
|-- variables.tf
`-- outputs.tf
terraform {
required_version = ">= 1.8.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
Run terraform fmt -check, terraform init, terraform validate, and terraform plan before any production apply step.
Step 6: Deploy the Application to Kubernetes
Kubernetes defines how the application should run, how many replicas it needs, what resources it can use, and how its health should be checked.
apiVersion: apps/v1
kind: Deployment
metadata:
name: modern-devops-demo
namespace: production
spec:
replicas: 3
selector:
matchLabels:
app: modern-devops-demo
template:
metadata:
labels:
app: modern-devops-demo
spec:
securityContext:
runAsNonRoot: true
Readiness probes tell Kubernetes when the app can receive traffic. Liveness probes detect when the app has become unhealthy and may need a restart.
Step 7: Use GitOps Instead of Direct Production Deployment
GitOps separates image creation from deployment. Instead of pushing directly to the cluster from CI, the pipeline updates deployment configuration in Git and a controller such as Argo CD or Flux applies the approved change.
platform-config/
|-- applications/
| `-- order-api/
| |-- base/
| `-- overlays/
| |-- staging/
| `-- production/
`-- clusters/
|-- staging/
`-- production/
Step 8: Add Security to Every Stage
DevSecOps means adding security into development and delivery instead of reviewing it once at the end.
- Scan the repository for leaked secrets.
- Scan dependencies for vulnerable packages.
- Scan container images before release.
- Enforce Kubernetes policies with policy-as-code.
- Limit production access and use short-lived credentials.
- name: Scan repository for secrets
uses: gitleaks/gitleaks-action@v2
Step 9: Manage Secrets Outside the Repository
Passwords, tokens, and certificates should not live in source code or plain deployment files. Use a dedicated secret management system such as HashiCorp Vault, AWS Secrets Manager, Azure Key Vault, or Google Secret Manager.
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: application-secrets
namespace: production
Step 10: Add Observability with OpenTelemetry
A deployment is not complete when the app starts. The team must know whether it is healthy, fast, and reliable.
Key signals include request rate, error rate, response time, CPU and memory usage, database latency, queue processing time, change failure rate, and mean time to recovery.
Step 11: Add a Safe Rollback Strategy
Every production deployment can fail, so rollback should be a normal, tested process rather than an emergency improvisation.
Rolling deployment
Kubernetes gradually replaces older instances with newer ones.
Blue-green deployment
Old and new versions run separately, and traffic switches only after validation.
Canary deployment
A small percentage of users receive the new version first, and the rollout continues only if metrics remain healthy.
Step 12: Introduce Platform Engineering Gradually
As systems grow, developers are asked to understand Kubernetes, networking, infrastructure, secrets, monitoring, and policy. Platform engineering reduces this cognitive load by offering reusable templates, workflows, and safe defaults.
platform create-service \
--name order-api \
--runtime node \
--database postgres \
--environment staging
Step 13: Add Cloud Cost Controls
A technically successful application can still waste money. Tag cloud resources consistently and review oversized, idle, or unused infrastructure regularly.
tags = {
Environment = "production"
Application = "order-api"
Team = "platform"
CostCenter = "engineering"
ManagedBy = "terraform"
}
Recommended Modern DevOps Pipeline Flow
- Developer creates a feature branch.
- Developer opens a pull request.
- CI runs linting, tests, and scans.
- A reviewer approves the change.
- Code is merged into the protected main branch.
- CI creates and scans an immutable container image.
- The GitOps repository is updated.
- Argo CD or Flux synchronizes the environment.
- Health checks and metrics are evaluated.
- The deployment continues or is rolled back.
Common DevOps Pipeline Mistakes
- Using one server for development, staging, and production.
- Deploying directly from a developer's computer.
- Working directly on the main branch.
- Using only the
latestimage tag. - Giving CI permanent administrator access.
- Storing secrets in Git.
- Creating production infrastructure manually.
- Ignoring application health after deployment.
- Automating a broken process.
- Introducing too many tools at once.
DevOps Pipeline Implementation Roadmap
Phase 1: Build the foundation
- Git standards and feature branches
- Protected main branch
- Automated testing
- Container builds and registry
- Staging environment
Phase 2: Automate infrastructure
- Terraform and remote state
- Kubernetes and GitOps
- Environment-specific configuration
- Backup procedures
Phase 3: Improve security
- Dependency, secret, and container scanning
- Policy-as-code
- Centralized secrets management
Phase 4: Improve reliability
- OpenTelemetry and centralized logs
- Dashboards and actionable alerts
- Canary or blue-green deployments
- Tested rollback procedures
Phase 5: Standardize developer experience
- Reusable templates
- Infrastructure modules
- Self-service environments
- Documentation and platform capabilities
Modern DevOps Pipeline Checklist
- [ ] Developers use feature branches.
- [ ] The main branch is protected.
- [ ] Pull requests require review.
- [ ] Automated tests run before merging.
- [ ] Dependency and secret scans run automatically.
- [ ] Container images use immutable tags.
- [ ] Images are scanned before deployment.
- [ ] Infrastructure is managed through code.
- [ ] Staging and production are separated.
- [ ] Production changes require approval.
- [ ] Secrets are stored outside Git.
- [ ] Containers do not run as root.
- [ ] CPU and memory limits are defined.
- [ ] Readiness and liveness probes are configured.
- [ ] Logs, metrics, and traces are centralized.
- [ ] Deployment health is monitored.
- [ ] Rollback procedures are documented and tested.
- [ ] Cloud costs are assigned to applications and teams.
- [ ] Production access follows least-privilege principles.
Frequently Asked Questions
What is a DevOps pipeline?
A DevOps pipeline is an automated process that moves application changes through testing, security checks, packaging, deployment, and monitoring.
What is the difference between CI and CD?
Continuous integration validates code changes through builds and tests. Continuous delivery prepares approved code for release, while continuous deployment automatically releases approved changes without a manual production step.
Is Kubernetes required for DevOps?
No. Applications can also be deployed to virtual machines, serverless platforms, managed services, or traditional hosting environments.
What is GitOps?
GitOps is a deployment approach where Git contains the desired state and a controller applies approved changes to the running environment.
What is DevSecOps?
DevSecOps integrates security checks into development and deployment workflows.
Should staging and production use separate servers?
Yes. They should generally use separate environments so production workloads, credentials, and data remain protected from staging activity.
How long does it take to build a DevOps pipeline?
A basic pipeline can be created quickly, but a production-ready system takes longer because it also needs access control, monitoring, scanning, and rollback planning.
Can AI manage DevOps deployments?
AI can help with analysis, review, and summarization, but high-impact production changes should remain behind deterministic checks, restricted permissions, and approval workflows.
Final Thoughts
A modern DevOps pipeline is not defined by the number of tools it contains. Its value comes from making software delivery safer, more predictable, and easier to understand.
Start with the essentials: protect the main branch, automate testing, create immutable artifacts, keep staging separate from production, store deployment and infrastructure configuration in Git, add security before release, monitor the application after deployment, and make rollback simple.
Latest Blog Posts
Single blog pages usually work better when they recommend more content at the end, so this section pulls the latest entries from shared PHP post data.
6 Major IT Development Updates Developers Should Know — July 2026
A practical roundup of GitHub Code Quality, the stateless MCP specification, Google Conductor, EKS rollbacks, AWS TypeScript support, and the GitHub Models shutdown.
Read articleInfosys Fined EUR 175,000 in France Over Employee Time-Tracking System
What the French penalty means, why reliable time-recording systems matter, and the compliance lessons global companies should take seriously.
Read articleHow to Build a Modern DevOps Pipeline in 2026
A practical guide covering CI/CD, Docker, Terraform, Kubernetes, GitOps, secrets management, observability, rollback strategy, and platform engineering.
Read article