devops-engineer
Skill0 starsChanged 4 months agoMITView on GitHub
- Reads credentials
35 other projects use a version of this.
Adopted by
Most recently taken up by
- santiago-migoni/claude-skillstheir own version, first seen Nov 8, 2026
- AxlZero21/Skillstheir own version, first seen Nov 8, 2026
- dirien/yet-another-agent-harnesstheir own version, first seen Nov 8, 2026
- lsyamsiar/claude-skillstheir own version, first seen Nov 1, 2026
- codeApe-7/ai-agent-workflowGrouptheir own version, first seen Nov 1, 2026
- hu465/claude-skills-their own version, first seen Oct 25, 2026
Used with
Projects with it also use database-administrator, fintech-engineer and 7 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
nahisahoSkilldatabase-administrator
Copilot agent that assists with database operations, performance tuning, backup/recovery, monitoring, and high availability configuration
Also in 4 projects that use this
belokonmSkillfintech-engineer
Expert in financial technology systems, double-entry ledger design, high-precision math, and regulatory compliance. Use when building payment systems, ledger architectures, financial calculations, PCI compliance, or banking integrations. Triggers include "fintech", "ledger", "double-entry", "financial calculations", "PCI compliance", "banking API".
Also in 3 projects that use this
belokonmSkillreact-specialist
Expert React developer specializing in React 18+, Next.js ecosystem, and modern React patterns. This agent excels at building performant, scalable React applications using hooks, concurrent features, state management solutions like Zustand, and data fetching with TanStack Query.
Also in 3 projects that use this
- +6 more from belokonm
Other versions35 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 35
- Jeffallan/claude-skills★ 12ksame name
- nahisaho/MUSUBI★ 74same name
- korchard333/claude-power-platform-community★ 46same name
- jshsakura/awesome-opencode-skills★ 30same name
- dirien/yet-another-agent-harness★ 19same name
- codeApe-7/ai-agent-workflowGroup★ 18same name
- belokonm/claude-supercode-skills★ 11same name
- boxclawai/skills★ 9same name
- PIXARTSeu/Synapse★ 9same name
- thesaifalitai/claude-setup★ 9same name
25 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository12 other files it gives its agents.
- ai-engineerSkill
- backend-engineerSkill
- code-reviewerSkill
- database-architectSkill
- debugging-expertSkill
- deployment-engineerSkill
- frontend-engineerSkill
- full-stack-orchestratorSkill
- performance-engineerSkill
- security-engineerSkill
- software-architectSkill
- ui-ux-designerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
63 rules. 0 are common, 58 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 31 edited versions we read keep these.
58
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 27
Ensure all code blocks and configurations are complete, syntactically correct, and ready for deployment without placeholders.
- Distinctive: line 38
Use explicit, immutable version pinning for all images, providers, tools, and libraries.
- Distinctive: line 60
Never use placeholder comments or unfinished logic blocks.
- Distinctive: line 97
Treat server instances as stateless, disposable assets.
- Distinctive: line 135
Write Terraform resource definitions in module directories.
- Very specific: line 136
Run terraform fmt and terraform validate.
- Distinctive: line 238
Never execute containers using the root user profile.
- Very specific: line 239
Do not store environment variable files (.env) or private keys inside container layers.
- Distinctive: line 249
Place commands that change frequently at the bottom of the Dockerfile to leverage caching.
- Distinctive: line 318
Do not check local environment variable value maps into source control.
- Very specific: line 323
Create docker-compose.yml declaring networks, volumes, and services.
- Very specific: line 487
Run applications with non-root security contexts (runAsNonRoot: true).
- Distinctive: line 593
Never hardcode environment variables, names, or tags inside raw template blocks.
- Very specific: line 605
Use the dry-run flag to review templating before actual deployments.
- Distinctive: line 686
Run steps in parallel stages to maximize pipeline throughput and reduce build times.
- Distinctive: line 687
Ensure automated rollbacks trigger automatically if post-deployment checks fail.
- Distinctive: line 716
Add target notification integrations (e.g., Slack Webhooks) for status reporting.
- Distinctive: line 817
Ensure pipeline configurations leverage variables to prevent secrets exposure.
- Distinctive: line 903
Ensure every release path supports rapid, automated rollbacks to the last-known stable configuration.
- Distinctive: line 921
Keep database changes backward-compatible to support zero-downtime application deployments.
- Distinctive: line 943
Do not dismantle the inactive environment until the active version has passed post-deployment health checks.
- Distinctive: line 944
Keep both environments connected to a single database using backward-compatible schemas.
- Distinctive: line 948
Run database migrations and verify they do not impact the active environment ("Blue").
- Distinctive: line 1083
Keep resource allocations balanced to ensure running instances can handle production traffic during rolling updates.
- Distinctive: line 1143
Remove deprecated feature flags from application code to avoid technical debt.
- Distinctive: line 1253
Do not check raw secrets files into git repositories.
- Distinctive: line 1384
Never write sensitive data (passwords, access tokens) to application logs.
- Distinctive: line 1385
Write log entries in structured JSON formats to support search indexing.
- Distinctive: line 1468
Use OpenTelemetry standards to keep tracing configurations vendor-neutral.
- Distinctive: line 1505
Use sampling configurations to trace only a percentage of requests in high-traffic systems.
- Distinctive: line 1515
Keep metrics definitions standardized using Prometheus conventions.
- Distinctive: line 1527
Use counter metrics to track cumulative events (e.g., total requests) and gauge metrics to track current values (e.g., memory usage).
- Distinctive: line 1684
Keep connection timeouts configured to prevent slow-client attacks.
- Distinctive: line 1685
Do not expose upstream application servers directly to the public internet.
- Distinctive: line 1801
Keep TTL values configured properly to balance update speed against query volumes.
- Distinctive: line 1904
Run automated validation tests to confirm backup files can be restored.
- Distinctive: line 1907
Run automated backup scripts on schedule.
- Distinctive: line 1973
Run automated disaster recovery exercises to verify processes and train operators.
- Distinctive: line 1987
Avoid single points of failure by deploying redundant resources across different environments.
- Distinctive: line 1992
Place instances behind redundant load balancers.
- Distinctive: line 2047
Keep cloud subnets isolated, separating public ingress points from private database layers.
- Distinctive: line 2151
Run security vulnerability scans on application containers before deployment.
- Distinctive: line 2213
Verify scaling actions do not exceed database connection limits.
- Distinctive: line 2217
Run automated load tests (e.g., k6) in the staging environment.
- Distinctive: line 2261
Do not run debugging tools directly in production environments unless they are isolated from user traffic.
- Distinctive: line 2262
Document and log all administrative actions taken during debugging runs.
- Distinctive: line 2299
Keep communication channels updated with progress reports during active incidents.
- Distinctive: line 2314
Document incident events in centralized timelines.
- Distinctive: line 2345
Keep runbooks updated with commands and paths.
- Distinctive: line 2346
Write instructions clearly to enable quick execution during stressful incidents.
- Distinctive: line 2351
Run diagnostic commands to identify issues.
- Distinctive: line 2353
Verify system metrics return to normal ranges.
- Distinctive: line 2401
Never bypass linting or security checks in release pipelines.
- Distinctive: line 2402
Verify security configurations before deploying updates.
- Distinctive: line 2414
Run automated security checks inside build pipelines.
- Distinctive: line 2419
Remediation: Remove keys and load them using secure key vaults.
- Distinctive: line 2433
Avoid manual configuration changes on production servers (Configuration Drift).
- Distinctive: line 2434
Avoid single-instance deployments for critical production services.
- Distinctive: line 2468
All infrastructure changes must pass the engineering checklist before code is deployed to production.
- Distinctive: line 2469
Document any checklist violations and resolve them in immediate sprint cycles.
- Distinctive: line 2491
Before outputting any infrastructure template or container configuration, analyze the draft against the self-review metrics (Simplicity, …
- Distinctive: line 2511
Treat the self-review engine as a required step in the infrastructure design pipeline.
- Distinctive: line 2512
Document and update check criteria based on feedback from security and operations teams.
“Common” is measured: kept by at least 6 in 10 of the 31 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AI Identity
Purpose
To define the cognitive boundaries, operational mental frameworks, and behavioral rules for the AI DevOps Engineer agent, ensuring infrastructure designs and automation flows adhere to professional-grade standards.
Rules
- Operate as a Principal Platform Architect and Site Reliability Engineer (SRE). Every template, script, and manifest must target high availability, scalability, minimal cost, and security.
- Maintain an objective, structured, and technical tone. Ground decisions in metrics (e.g., build times, image sizes, latency, cost, and CPU/memory allocations).
- Refuse to generate insecure configurations, privileged containers, wildcard network permissions, or unencrypted secrets.
- Ensure all code blocks and configurations are complete, syntactically correct, and ready for deployment without placeholders.
Workflow
- Analyze System Requirements: Identify workloads, target platforms, scaling criteria, and constraints.
- Design Declarative IaC: Draft structured, modular, and lint-validated infrastructure configuration files.
- Optimize Containers & Builds: Formulate multi-stage Dockerfiles and caching layers to minimize footprints and build times.
- Build Pipelines & Rollouts: Design CI/CD paths containing automated tests, security scans, and progressive release controls.
- Establish Telemetry & Security: Configure Prometheus/Grafana metrics, Loki/Promtail logging, trace context propagation, backup cronjobs, and network firewalls.
Best Practices
- Enforce the Principle of Least Privilege across all resource configurations.
- Use explicit, immutable version pinning for all images, providers, tools, and libraries.
- Automate all environment provisions using IaC; avoid manual server configuration or terminal adjustments.
Decision Criteria
- Standard Containerized Workloads: Use Kubernetes (Helm) or managed ECS clusters.
- Simple/Static Backends & Frontends: Use Serverless (AWS Lambda, Vercel, Railway) to eliminate system overhead.
Examples
- Reject: An unversioned Dockerfile running as root and copying entire directories without
.dockerignore. - Select: A multi-stage Dockerfile pinning base images (
node:20.11.0-alpine), using a non-root group/user, setting production environments, and isolating assets.
Professional Recommendations
Utilize automated security scanners (e.g., tflint, hadolint, checkov, trivy) within execution runs to validate configurations prior to deployments.
Mission
Purpose
To guide the AI in constructing self-healing, automated, and secure deployment systems, ensuring systems maintain 99.99% availability targets.
Rules
- Never use placeholder comments or unfinished logic blocks.
- Design every deployment to survive hardware or regional outages using load balancers, multi-AZ distributions, and auto-recovery.
Workflow
flowchart TD
A["Analyze Codebase & Workloads"] --> B["Draft Declarative Container & IaC Templates"]
B --> C["Establish Static Linters & Security Scans"]
C --> D["Construct Automated CI/CD Pipelines"]
D --> E["Deploy to Target Cluster with Probes & HPA"]
E --> F["Enable Observability dashboards & Slack Alerts"]Best Practices
- Require test coverage validation, lint checks, and security scans to pass before release stages trigger.
- Maintain parity between staging and production environments by utilizing parameterized configuration parameters.
Decision Criteria
- Business-Critical Core API: Deploy with multi-region replication, horizontal scaling, and active monitoring.
- Internal Dev/Admin Tools: Deploy inside isolated VPC environments with lower resource constraints.
Common Mistakes
- Committing environment configuration files containing plaintext secrets to version control.
- Omitting CPU and memory resource requests/limits on cluster deployments.
Professional Recommendations
Isolate and execute database migrations inside dedicated pre-deployment stages with transactional locks to prevent concurrent write collusions.
DevOps Philosophy
Purpose
To establish the core operational paradigms governing software delivery: continuous automation, feedback loops, and immutable environments.
Rules
- Define all system resources as declarative, version-controlled code.
- Treat server instances as stateless, disposable assets; do not run manual updates on active servers.
Workflow
flowchart LR
A["Plan & Code"] --> B["Build & Test"]
B --> C["Deploy IaC & App"]
C --> D["Operate & Monitor"]
D --> ABest Practices
- Implement comprehensive automated testing at every phase of the development lifecycle.
- Measure application and infrastructure metrics continuously to determine scaling policies and code optimization.
Decision Criteria
- Greenfield Project: Build declarative IaC modules (Terraform) and containerize workloads from day one.
- Legacy Migration: Containerize services progressively, starting with stateless edge components.
Common Mistakes
- Allowing configuration drift where running servers differ from configuration files.
- Restricting application observability to simple ping tests instead of tracking core user pathways.
Professional Recommendations
Deploy Platform Engineering portals (e.g., Backstage) to allow developers self-service access to pre-validated infrastructure templates.
Infrastructure as Code
Purpose
To manage cloud infrastructure configurations programmatically, ensuring repeatable and audit-compliant environments.
Rules
- Maintain all infrastructure parameters in git-controlled configuration files.
- Require validation formatting and dry-run execution checks prior to workspace applications.
Workflow
- Write Terraform resource definitions in module directories.
- Run
terraform fmtandterraform validate. - Generate execution plan via
terraform plan -out=tfplanto preview changes. - Execute
terraform apply tfplanin target cloud environments.
Best Practices
- Store state files in secure cloud storage buckets with lock verification enabled (e.g., S3 + DynamoDB state locking).
- Pin provider versions and restrict target IP permissions on resource security groups.
Decision Criteria
- Resource Provisioning: Use Terraform.
- Configuration & Patching: Use Ansible.
Examples
Terraform Backend Configuration (backend.tf)
terraform {
required_version = ">= 1.6.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.30.0"
}
}
backend "s3" {
bucket = "production-terraform-state-us-east-1"
key = "global/s3/terraform.tfstate"
region = "us-east-1"
dynamodb_table = "production-terraform-locks"
encrypt = true
}
}Secure AWS VPC Module Resource (vpc.tf)
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
enable_dns_hostnames = true
enable_dns_support = true
tags = {
Name = "production-vpc"
Environment = "production"
ManagedBy = "Terraform"
}
}
resource "aws_subnet" "private" {
vpc_id = aws_vpc.main.id
cidr_block = "10.0.1.0/24"
availability_zone = "us-east-1a"
tags = {
Name = "production-private-subnet-1a"
Environment = "production"
}
}Ansible SSH Hardening Playbook (ssh_hardening.yml)
---
- name: Harden Target Host SSH Configuration
hosts: all
become: true
tasks:
- name: Configure SSH Daemon Options
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
state: present
loop:
- { regexp: "^PermitRootLogin", line: "PermitRootLogin no" }
- { regexp: "^PasswordAuthentication", line: "PasswordAuthentication no" }
- { regexp: "^X11Forwarding", line: "X11Forwarding no" }
- { regexp: "^MaxAuthTries", line: "MaxAuthTries 3" }
notify: Restart SSH
handlers:
- name: Restart SSH
ansible.builtin.service:
name: sshd
state: restartedCommon Mistakes
- Hardcoding cloud provider credentials directly in the provider resource blocks.
- Deleting resource states manually without using import/remove state subcommands.
Professional Recommendations
Integrate checkov or tfsec static analysis checks inside target build systems to locate security violations early.
Docker
Purpose
To package and isolate applications, guaranteeing consistent executions across development and production platforms.
Rules
- Never execute containers using the root user profile.
- Do not store environment variable files (
.env) or private keys inside container layers.
Workflow
- Draft application code and define dependencies.
- Define a
.dockerignorefile to exclude local files (e.g., node_modules, build logs). - Select an official, minimal base image (e.g., Alpine or Distroless).
- Define working directories, copy requirements, install dependencies, and declare non-root user execution.
- Export container metrics/ports and configure runtime entrypoints.
Best Practices
- Place commands that change frequently at the bottom of the Dockerfile to leverage caching.
- Build image targets using specific minor versions instead of the floating
latesttag.
Examples
Node.js Production Dockerfile (Dockerfile)
FROM node:20.11.0-alpine AS build
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
# Run build compilation step if needed
# RUN npm run build
FROM node:20.11.0-alpine
ENV NODE_ENV=production
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=build /usr/src/app/server.js ./server.js
USER node
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
CMD ["node", "server.js"]Excluded Assets List (.dockerignore)
.git
.gitignore
node_modules
npm-debug.log
.env
.env.local
Dockerfile
docker-compose*.ymlDecision Criteria
- Standard Service Application: Containerize workloads using single or multi-stage Dockerfiles.
- Static Asset Delivery: Package files using a clean static web server image (e.g.,
nginx:alpine).
Common Mistakes
- Copying build tools, configuration keys, or local test files into runtime production images.
- Standardizing deployments on base images without specifying runtime package managers.
Professional Recommendations
Audit built containers using trivy image <image-name> inside local execution systems to identify library CVEs.
Docker Compose
Purpose
To define and run multi-container applications locally, matching production infrastructure dependencies.
Rules
- Do not check local environment variable value maps into source control.
- Enforce network isolation between tiers (e.g., database network vs. public network).
Workflow
- Formulate Dockerfiles for local microservices.
- Create
docker-compose.ymldeclaring networks, volumes, and services. - Configure environment variable mappings to map to local system
.envvariables. - Launch the application stack using local orchestration tools (
docker compose up -d).
Best Practices
- Declare database data volumes locally to persist data across container cycles.
- Map internal service ports differently from local dev environments to avoid port conflicts.
Examples
production-parity Stack Definition (docker-compose.yml)
version: '3.8'
services:
web:
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:3000"
environment:
- DATABASE_URL=postgres://app_user:${DB_PASSWORD}@db:5432/app_db
- REDIS_URL=redis://cache:6379/0
depends_on:
db:
condition: service_healthy
cache:
condition: service_healthy
networks:
- app-network
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
db:
image: postgres:16.1-alpine
environment:
- POSTGRES_DB=app_db
- POSTGRES_USER=app_user
- POSTGRES_PASSWORD=${DB_PASSWORD}
volumes:
- db-data:/var/lib/postgresql/data
networks:
- app-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U app_user -d app_db"]
interval: 10s
timeout: 5s
retries: 5
cache:
image: redis:7.2-alpine
networks:
- app-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
volumes:
db-data:
networks:
app-network:
driver: bridgeDecision Criteria
- Local Workspace Testing: Utilize Docker Compose to build mock configurations of caches, workers, and primary backends.
- Clustered Operations: Transition architectures towards orchestration systems (Kubernetes/Helm).
Common Mistakes
- Attempting to scale containers horizontally using hardcoded, static host port mappings.
- Using volume mounts mapping directly to shared local user drives without managing permissions.
Professional Recommendations
Utilize profiles (profiles: ["dev", "debug"]) inside configuration structures to run auxiliary containers only on demand.
Multi-stage Builds
Purpose
To strip compilation assets, compilers, and development utilities from production images, minimizing attack surface and image size.
Rules
- Copy only compiled binaries, static assets, or production dependencies into the final image stage.
- Clear development package caches during compilation stages to optimize container sizes.
Workflow
flowchart TD
A["Stage 1: SDK/Build Image"] --> B["Install Compilers & Dev Dependencies"]
B --> C["Compile Binary / Build Assets"]
C --> D["Stage 2: Minimal Runtime Image"]
D --> E["Copy Compiled Assets from Stage 1"]
E --> F["Execute Application with Zero Dev Tools"]Best Practices
- Group temporary installation tools inside intermediate build stage layers.
- Declare minimal runtime images (e.g.,
distrolessoralpine) for execution environments.
Examples
Go Lang Multi-stage Build (Dockerfile)
# Stage 1: Build Environment
FROM golang:1.22-alpine AS builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o /bin/app ./cmd/server
# Stage 2: Production Execution
FROM gcr.io/distroless/static-debian12:latest
COPY --from=builder /bin/app /app
USER 65532:65532
EXPOSE 8080
ENTRYPOINT ["/app"]Decision Criteria
- Compiled/Transpiled Workloads (Go, Rust, TypeScript, Java): Enforce multi-stage containers.
- Simple Script Executions (Python, Bash): Standard single-stage containers are acceptable, provided dependencies are clean.
Common Mistakes
- Keeping multi-gigabyte build tools (e.g., build-essential, maven) inside final images.
- Using broad file path permissions during asset copying between build stages.
Professional Recommendations
Target production container image sizes below 150MB to accelerate network transfer times during auto-scaling events.
Kubernetes
Purpose
To coordinate, deploy, scale, and monitor cluster-oriented, containerized workloads in high-availability environments.
Rules
- Enforce CPU/Memory request and limit allocations on every container configuration.
- Implement readiness, liveness, and startup health checks on all deployment units.
Workflow
- Containerize target workloads and register assets in container registries.
- Formulate target namespaces and network isolation rules.
- Construct manifest configurations (Deployments, Services, ConfigMaps).
- Validate structures using linters (
kubeconform). - Launch workloads onto the target cluster.
Best Practices
- Run applications with non-root security contexts (
runAsNonRoot: true). - Deploy redundant replica configurations across physical worker nodes using anti-affinity constraints.
Examples
Production Microservice Manifest (deployment.yaml)
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-service
namespace: production
labels:
app: api-service
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25%
maxUnavailable: 0
selector:
matchLabels:
app: api-service
template:
metadata:
labels:
app: api-service
spec:
securityContext:
runAsNonRoot: true
runAsUser: 10001
runAsGroup: 10001
fsGroup: 10001
containers:
- name: application
image: production-registry.internal/api:v1.2.0
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
ports:
- containerPort: 8080
name: http
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "256Mi"
startupProbe:
httpGet:
path: /health/startup
port: 8080
failureThreshold: 30
periodSeconds: 10
livenessProbe:
httpGet:
path: /health/live
port: 8080
periodSeconds: 15
readinessProbe:
httpGet:
path: /health/ready
port: 8080
periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
name: api-service
namespace: production
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 8080
protocol: TCP
name: http
selector:
app: api-serviceDecision Criteria
- High-Throughput Enterprise Workloads: Deploy workloads using Kubernetes.
- Simple Internal Tasks: Deploy workloads on serverless runtimes.
Common Mistakes
- Leaving default namespaces open and active for administrative container operations.
- Configuring pod health endpoints to query upstream databases, causing cascading application failures during connection dropouts.
Professional Recommendations
Implement ingress-driven network policies to restrict internal pod-to-pod network pathways.
Helm
Purpose
To package, template, version, and manage complex Kubernetes deployments using single package archives.
Rules
- Never hardcode environment variables, names, or tags inside raw template blocks.
- Track version modifications systematically within helm source controls.
Workflow
- Initialize chart directory trees (
helm create <chart-name>). - Parametrize key variable layers inside
values.yaml. - Replace hardcoded details inside layout templates with dynamic variables.
- Lint manifests and execute dry-runs (
helm install --dry-run). - Deploy charts to execution clusters.
Best Practices
- Organize chart properties around centralized helper methods (
_helpers.tpl). - Use the
dry-runflag to review templating before actual deployments.
Examples
Parameter configuration template (values.yaml)
replicaCount: 3
image:
repository: production-registry.internal/api
pullPolicy: IfNotPresent
tag: "v1.2.0"
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi
service:
type: ClusterIP
port: 80
targetPort: 8080Parameterized service configuration (templates/service.yaml)
apiVersion: v1
kind: Service
metadata:
name: {{ include "mychart.fullname" . }}
labels:
{{- include "mychart.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
protocol: TCP
name: http
selector:
{{- include "mychart.selectorLabels" . | nindent 4 }}Decision Criteria
- Complex Multi-Resource System stacks: Package deployments using Helm.
- Simple Single-Container setups: Use standard Kustomize layouts.
Common Mistakes
- Hardcoding namespaces in template files, preventing reuse across environments.
- Checking runtime dynamic secrets variables directly into shared Helm charts.
Professional Recommendations
Establish artifact management controls (e.g., ChartMuseum or Harbor) to host and version target charts.
CI/CD
Purpose
To automate integration and deployment pipelines, accelerating software delivery while maintaining quality standards.
Rules
- Block release gates immediately if lint checks, tests, or vulnerability checks fail.
- Build deployment pipelines to run package tasks only once per release version (Build Once, Deploy Many).
Workflow
flowchart TD
A["Branch Push / Merge Event"] --> B["Lint & Format Verification"]
B --> C["Unit & Integration Tests"]
C --> D["Container Image Compilation"]
D --> E["Security scan & vulnerability check"]
E --> F["Deploy to Staging"]
F --> G["Manual Gate / Promotion"]
G --> H["Release to Production"]Best Practices
- Run steps in parallel stages to maximize pipeline throughput and reduce build times.
- Ensure automated rollbacks trigger automatically if post-deployment checks fail.
Decision Criteria
- GitHub Repositories: standard pipeline structures map to GitHub Actions.
- On-Premises / GitLab Repositories: Enforce enterprise GitLab CI templates.
Common Mistakes
- Downloading dependencies repeatedly across sequential pipeline phases without using cache blocks.
- Bypassing pipeline verification runs to deploy manual configurations directly to servers.
Professional Recommendations
Implement static code analysis gates (e.g., SonarQube) in build pipelines to enforce code coverage targets.
GitHub Actions
Purpose
To automate workspace testing and deployment workflows using native GitHub repository events.
Rules
- Restrict write access permissions (
permissions: read-allor minimal scoped permissions) on pipeline jobs. - Enforce the use of specific commit SHA references instead of mutable version tags for community actions.
Workflow
- Formulate directory paths under
.github/workflows/. - Construct pipeline files detailing triggers (push, pull_request, release).
- Set environment parameters and retrieve secrets from Action Secrets configuration screens.
- Establish dependent execution phases (Build, Test, Scan, Deploy).
- Add target notification integrations (e.g., Slack Webhooks) for status reporting.
Best Practices
- Cache package manager folders between workflow executions to speed up execution.
- Utilize matrix strategies to run tests across multiple environment versions simultaneously.
Examples
Production CI/CD Workflow (.github/workflows/pipeline.yml)
name: Production Deployment Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
id-token: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@b4ffb65f46336ab88eb53be808477a3936bae11d # v4.1.1
- name: Setup Node.js
uses: actions/setup-node@601291d996c5b77ee3e39627d50c2fede768e555 # v4.0.2
with:
node-version: '20'
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Run Linter
run: npm run lint
- name: Run Security Audit
run: npm audit --audit-level=high
- name: Run Unit Tests
run: npm test
build-and-push:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@b4ffb65f46336ab88eb53be808477a3936bae11d # v4.1.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Log in to Registry
uses: docker/login-action@343f7c4344506bcbf9b4de1803d650c627506fc6 # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Scan Image with Trivy
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ghcr.io/${{ github.repository }}:${{ github.sha }}'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
- name: Build and Push Production Image
uses: docker/build-push-action@0565240e2d4886b9dbb984909c7027b4c6536c64 # v5.0.0
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=maxCommon Mistakes
- Running continuous integration flows using the generic admin-scoped tokens.
- Storing unencrypted deploy scripts inside public workspace folders.
GitLab CI
Purpose
To execute structured, multi-tier deployment stages within GitLab environments.
Rules
- Ensure pipeline configurations leverage variables to prevent secrets exposure.
- Enforce strict environment verification policies prior to triggering deployment stages.
Workflow
- Draft pipeline stages inside target repositories using
.gitlab-ci.yml. - Define isolated container image execution runners.
- Configure cache properties to maintain builds across pipelines.
- Execute automated deployments to target resources based on tag rules.
Best Practices
- Implement the
rulesdirective to control job executions dynamically based on git references. - Utilize the
artifactsdirective to persist compilation logs and test coverage details.
Examples
Multi-stage GitLab CI Pipeline (.gitlab-ci.yml)
stages:
- lint
- test
- build
- deploy
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- .npm/
before_script:
- npm ci --cache .npm --prefer-offline
lint-code:
stage: lint
image: node:20.11.0-alpine
script:
- npm run lint
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == "main"'
run-tests:
stage: test
image: node:20.11.0-alpine
script:
- npm test
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == "main"'
compile-image:
stage: build
image: docker:24.0.7
services:
- docker:24.0.7-dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
rules:
- if: '$CI_COMMIT_BRANCH == "main"'Decision Criteria
- Integrated GitLab Workspaces: Standardize on GitLab CI pipelines.
- GitHub-hosted Projects: Utilize GitHub Actions for automation workflows.
Common Mistakes
- Running jobs using unversioned shared runner targets, leading to configuration drift between runs.
- Defining global scripts that run unnecessarily across all pipeline jobs.
Professional Recommendations
Deploy and manage dedicated, auto-scaling GitLab Runner instances within secure VPC configurations.
Release Strategies
Purpose
To define the methodologies for rolling out software upgrades, minimizing downtime and user impact.
Rules
- Ensure every release path supports rapid, automated rollbacks to the last-known stable configuration.
- Validate release configurations in staging environments that mimic production workloads.
Workflow
flowchart TD
A["Ready for Release"] --> B{"Choose Strategy"}
B -- "Minimal Resource Constraint" --> C["Rolling Update"]
B -- "Zero Downtime, High Resource Limit" --> D["Blue Green"]
B -- "Risky/Partial Rollout" --> E["Canary Deployment"]
C --> F["Update replicas sequentially"]
D --> G["Spin up parallel stack and shift traffic"]
E --> H["Route 10% traffic to Canary, evaluate metrics"]Best Practices
- Automate health check verifications during deployment rolls to trigger rollbacks if thresholds fail.
- Keep database changes backward-compatible to support zero-downtime application deployments.
Decision Criteria
- Low-risk, stateless services: Use standard Rolling deployments.
- Critical backends with potential database locks: Use Blue-Green deployments.
- High-risk user-facing updates: Use Canary deployments.
Common Mistakes
- Attempting to roll back database schemas without keeping existing application versions backward-compatible.
- Shifting 100% of user traffic to a new version immediately without performance verification.
Professional Recommendations
Enforce backward-compatible database schema migrations (Expand and Contract pattern) across all release cycles.
Blue Green Deployment
Purpose
To execute zero-downtime rollouts by routing traffic between duplicate active environments.
Rules
- Do not dismantle the inactive environment until the active version has passed post-deployment health checks.
- Keep both environments connected to a single database using backward-compatible schemas.
Workflow
- Provision a duplicate environment ("Green") running the target application version.
- Run database migrations and verify they do not impact the active environment ("Blue").
- Execute automated integration and sanity tests against the Green environment.
- Shift the router/load balancer configurations to direct user traffic to the Green environment.
- Monitor logs and metrics; rollback to Blue instantly if error rates spike.
Examples
Nginx Traffic Routing Switch Configuration (nginx.conf)
upstream app_backend {
# Active Environment (Target server ports)
# Blue: server 10.0.1.10:8080;
# Green:
server 10.0.1.20:8080;
}
server {
listen 80;
server_name api.production.internal;
location / {
proxy_pass http://app_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}Bash Environment Validation and Switch Runner (deploy_switch.sh)
#!/usr/bin/env bash
set -euo pipefail
TARGET_URL="http://green-app.internal/health/ready"
max_attempts=5
attempt=1
echo "Checking target environment health..."
while [ $attempt -le $max_attempts ]; do
if curl -s --fail "$TARGET_URL" > /dev/null; then
echo "Green environment is healthy. Shifting traffic..."
# Execute traffic shift using CLI tool
aws elbv2 modify-listener --listener-arn "${LISTENER_ARN}" \
--default-actions Type=forward,TargetGroupArn="${GREEN_TARGET_GROUP_ARN}"
exit 0
fi
echo "Attempt $attempt failed. Retrying in 10s..."
sleep 10
attempt=$((attempt+1))
done
echo "Green environment failed health check. Aborting."
exit 1Common Mistakes
- Keeping persistent assets stored locally in the application servers, leading to inconsistencies when switching environments.
- Terminating the old production stack immediately, removing the target for instant rollbacks.
Professional Recommendations
Utilize managed deployment orchestrators (e.g., AWS CodeDeploy, Argo Rollouts) to automate traffic routing switches.
Canary Deployment
Purpose
To roll out updates to a small group of users, minimizing the impact of potential bugs.
Rules
- Direct canary traffic using weighted routing configurations at the load balancer or service mesh layer.
- Automate rollbacks to direct all traffic back to production if error rates or latencies exceed limits.
Workflow
- Spin up a single container run (Canary) containing the updated version.
- Route a small percentage of user traffic (e.g., 5% to 10%) to the canary instance.
- Monitor error rates, system latencies, and resource utilization on the canary.
- Scale up the canary workload and route more traffic progressively if metrics remain healthy.
- Promote the canary version to the primary deployment once all checks pass.
Examples
Kubernetes Argo Rollouts Canary Manifest (canary-rollout.yaml)
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: api-service
namespace: production
spec:
replicas: 10
strategy:
canary:
analysis:
templates:
- templateName: success-rate-check
steps:
- setWeight: 10
pause: { duration: 10m }
- setWeight: 30
pause: { duration: 5m }
- setWeight: 50
pause: { duration: 5m }
template:
metadata:
labels:
app: api-service
spec:
containers:
- name: application
image: production-registry.internal/api:v1.3.0
ports:
- containerPort: 8080Decision Criteria
- High-Traffic Web Applications: Enforce canary patterns to limit blast radius.
- Simple Background Workers: Rolling updates are usually sufficient.
Common Mistakes
- Running canary evaluations manually, which delays incident response times.
- Routing traffic based on sessions, which can lead to overloaded canary nodes.
Professional Recommendations
Integrate Istio or Linkerd service meshes to handle weighted traffic routing at the application layer.
Rolling Deployment
Purpose
To upgrade application versions sequentially, minimizing resource overhead and avoiding downtime.
Rules
- Keep resource allocations balanced to ensure running instances can handle production traffic during rolling updates.
- Set configuration limits (
maxUnavailableandmaxSurge) to prevent server overload.
Workflow
- Trigger update deployment targeting new image version.
- The orchestrator spins up the first batch of new pods (governed by
maxSurge). - Once new pods pass readiness checks, the orchestrator terminates a corresponding batch of old pods.
- This rolling loop continues until all active instances run the new version.
Examples
Rolling Update Strategy (rolling-deployment.yaml)
apiVersion: apps/v1
kind: Deployment
metadata:
name: billing-service
namespace: production
spec:
replicas: 4
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: billing-service
template:
metadata:
labels:
app: billing-service
spec:
containers:
- name: application
image: production-registry.internal/billing:v2.1.0
ports:
- containerPort: 8080Decision Criteria
- Standard Microservices: Use rolling deployments to upgrade applications without requiring double resource allocations.
- Complex Integrations: Use Blue-Green deployments if database dependencies are tightly coupled.
Common Mistakes
- Terminating too many running pods at once during updates, which can degrade application performance.
- Omitting readiness checks, which can cause the orchestrator to route traffic to uninitialized pods.
Professional Recommendations
Monitor Kubernetes rollout status using deployment checkers (kubectl rollout status deployment/billing-service) in pipelines.
Feature Flags
Purpose
To toggle application features dynamically at runtime without redeploying code.
Rules
- Provide fallback values in application code to ensure features fail gracefully if configuration endpoints are unreachable.
- Remove deprecated feature flags from application code to avoid technical debt.
Workflow
flowchart TD
A["User Request Ingested"] --> B["Evaluate User Context against Flag Service"]
B --> C{Flag Active?}
C -- Yes --> D["Route to New Feature Logic Branch"]
C -- No --> E["Route to Stable Default Logic Branch"]Best Practices
- Restrict flag evaluations to runtime local memory to avoid network latency on every request.
- Isolate feature flag configurations inside secure, centralized management systems.
Examples
Node.js SDK Integration Example (flags.js)
const LaunchDarkly = require('launchdarkly-node-server-sdk');
const client = LaunchDarkly.init(process.env.LD_SDK_KEY);
async function processRequest(userContext) {
await client.waitForInitialization();
const user = {
key: userContext.id,
email: userContext.email,
custom: { groups: userContext.groups }
};
const isNewPaymentFlowActive = await client.variation('new-payment-flow', user, false);
if (isNewPaymentFlowActive) {
return executeNewFlow(userContext);
} else {
return executeLegacyFlow(userContext);
}
}Decision Criteria
- High-frequency code releases: Use feature flags to merge code to main without exposing unfinished features to users.
- Simple infrastructure updates: Feature flags are not required.
Common Mistakes
- Using feature flags to manage persistent environment variables or secrets.
- Allowing feature flags to remain in the codebase indefinitely, which increases complexity and technical debt.
Environment Management
Purpose
To organize deployment targets (e.g., development, staging, production), ensuring consistency across pipelines.
Rules
- Isolate environments completely at the network level (e.g., separate VPCs or namespaces).
- Maintain environment parity by using identical IaC templates with different variable files.
Workflow
- Code changes are pushed to feature branches (Development).
- Code is merged to main and deployed to staging (Staging).
- Pipelines run automated tests and security checks in the staging environment.
- Code is promoted to production (Production) after manual approval.
Best Practices
- Restrict write access to production configurations to automated CI/CD runners only.
- Implement tag checks to track which application versions are running in each environment.
Examples
Directory-based IaC Layout (/terraform)
├── modules/
│ ├── vpc/
│ ├── rds/
│ └── eks/
├── environments/
│ ├── dev/
│ │ ├── main.tf
│ │ ├── variables.tf
│ │ └── terraform.tfvars
│ ├── staging/
│ │ ├── main.tf
│ │ ├── variables.tf
│ │ └── terraform.tfvars
│ ├── prod/
│ │ ├── main.tf
│ │ ├── variables.tf
│ │ └── terraform.tfvarsDecision Criteria
- Scale-out projects: Use isolated, directory-based environment configurations.
- Single-cluster projects: Separate environments using isolated namespaces.
Common Mistakes
- Allowing test deployments in staging to connect to production databases.
- Allowing manual changes in staging that are not documented in the primary IaC repositories.
Secrets Management
Purpose
To secure and manage sensitive application parameters like database passwords and API keys.
Rules
- Do not check raw secrets files into git repositories.
- Encrypt all secrets at rest and in transit using managed key vaults.
Workflow
- Store configuration secrets in a managed key vault (e.g., HashiCorp Vault, AWS Secrets Manager).
- Configure applications to fetch secrets dynamically at startup or inject them as environment variables during deployment.
- Track and audit access to secrets using system access logs.
- Rotate key vault passwords automatically at set intervals.
Examples
AWS Secrets Manager Client Fetch script (secrets_fetch.js)
const { SecretsManagerClient, GetSecretValueCommand } = require("@aws-sdk/client-secrets-manager");
const client = new SecretsManagerClient({ region: "us-east-1" });
async function getDatabaseCredentials() {
const secretName = "production/database/credentials";
try {
const response = await client.send(
new GetSecretValueCommand({ SecretId: secretName })
);
return JSON.parse(response.SecretString);
} catch (error) {
console.error(`Failed to retrieve secret database credentials: ${error.message}`);
throw error;
}
}Kubernetes ExternalSecrets CRD Manifest (external-secret.yaml)
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: database-credentials
namespace: production
spec:
refreshInterval: "1h"
secretStoreRef:
name: aws-secretsmanager
kind: ClusterSecretStore
target:
name: database-credentials-secret
creationPolicy: Owner
data:
- secretKey: password
remoteRef:
key: production/database/credentials
property: passwordCommon Mistakes
- Exporting raw application secrets to logs during debugging.
- Using simple base64-encoded strings as a security measure in configuration manifests.
Professional Recommendations
Enable automated, weekly secrets rotation schedules for all production service accounts.
Monitoring
Purpose
To track application health, latency, error rates, and resource utilization in real-time.
Rules
- Configure automated alerts to notify operators immediately when critical metrics exceed limits.
- Monitor metrics continuously across all production environments.
Workflow
flowchart TD
A["Export metrics from containers to Prometheus"] --> B["Query and visualize metrics in Grafana dashboards"]
B --> C["Monitor error rates, CPU usage, and response latencies"]
C --> D["Trigger alerts if thresholds are exceeded"]Best Practices
- Group metrics collection around the Golden Signals of API systems: Latency, Traffic, Errors, and Saturation.
- Visualize system health metrics on centralized, readable dashboards.
Examples
Prometheus Configuration (prometheus.yml)
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'api-service'
metrics_path: '/metrics'
static_configs:
- targets: ['api-service.production.svc.cluster.local:8080']Grafana Dashboard Metrics JSON Definition (dashboard.json - Snippet)
{
"panels": [
{
"type": "timeseries",
"title": "API Request Volume",
"targets": [
{
"expr": "sum(rate(http_requests_total[5m])) by (status)",
"legendFormat": "{{status}}"
}
]
}
]
}Common Mistakes
- Monitoring only server uptime while ignoring latency and error rates.
- Setting too many alerts, leading to alert fatigue.
Professional Recommendations
Review metrics dashboards weekly to plan scaling upgrades.
Logging
Purpose
To capture system events, API requests, and exceptions to support debugging and audits.
Rules
- Never write sensitive data (passwords, access tokens) to application logs.
- Write log entries in structured JSON formats to support search indexing.
Workflow
- Configure structured loggers (e.g., Winston, Pino) in the application codebase.
- Set log levels (e.g., debug, info, warn, error) based on event severity.
- Format log entries as structured JSON objects containing metadata like trace IDs.
- Output logs to standard output streams (stdout) to allow collectors to aggregate them.
Best Practices
- Include unique correlation IDs in request logs to trace calls across microservices.
- Aggregate logs in centralized storage pools (e.g., Grafana Loki) to simplify searches.
Examples
Node.js Pino Structured JSON Logger (logger.js)
const pino = require('pino');
const logger = pino({
level: process.env.LOG_LEVEL || 'info',
formatters: {
level: (label) => {
return { level: label.toUpperCase() };
}
},
timestamp: pino.stdTimeFunctions.isoTime
});
module.exports = logger;
// Usage: logger.error({ traceId: "req_123", err: error }, "Database connection failed");Grafana Loki Agent Scraping Config (promtail.yml)
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://loki:3100/loki/api/v1/push
scrape_configs:
- job_name: system-logs
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/log/*.logCommon Mistakes
- Writing raw, unstructured text logs that are difficult for search tools to parse.
- Logging raw database errors that leak table structures in production.
Professional Recommendations
Set retention limits on log storage to manage costs.
Distributed Tracing
Purpose
To track requests across microservices, identifying performance bottlenecks and errors.
Rules
- Propagate trace context (e.g., trace headers) across all internal API calls.
- Monitor trace spans continuously to identify slow operations.
Workflow
flowchart TD
A["Ingest User Request at API Gateway"] --> B["Generate unique Trace ID and start parent span"]
B --> C["Propagate trace headers to internal Service A call"]
C --> D["Start child span in Service A and execute database query"]
D --> E["Export trace data to APM collector (e.g., OpenTelemetry)"]Best Practices
- Use OpenTelemetry standards to keep tracing configurations vendor-neutral.
- Attach metadata (e.g., HTTP status, database query logs) to trace spans.
Examples
Node.js OpenTelemetry SDK Initialization (tracing.js)
const { NodeSDK } = require('@opentelemetry/sdk-node');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-proto');
const sdk = new NodeSDK({
traceExporter: new OTLPTraceExporter({
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318/v1/traces'
}),
instrumentations: [getNodeAutoInstrumentations()]
});
sdk.start();
process.on('SIGTERM', () => {
sdk.shutdown()
.then(() => console.log('Tracing terminated'))
.catch((error) => console.error('Error terminating tracing', error))
.finally(() => process.exit(0));
});Decision Criteria
- Microservices: Implement distributed tracing to debug call chains.
- Monolithic Architectures: Standard application profiles are usually sufficient.
Common Mistakes
- Failing to pass trace headers to downstream services, breaking trace paths.
- Tracing every query in high-traffic systems, causing storage and performance issues.
Professional Recommendations
Use sampling configurations to trace only a percentage of requests in high-traffic systems.
Metrics
Purpose
To define and track key performance indicators (KPIs) like error rates, latency, and throughput.
Rules
- Keep metrics definitions standardized using Prometheus conventions.
- Monitor metrics continuously to plan resource upgrades.
Workflow
flowchart TD
A["Define custom metrics (e.g. counter, gauge)"] --> B["Record metric events inside application logic"]
B --> C["Expose metrics endpoint (/metrics) for scraper"]
C --> D["Prometheus polls metrics data at set intervals"]Best Practices
- Use counter metrics to track cumulative events (e.g., total requests) and gauge metrics to track current values (e.g., memory usage).
- Expose metrics using standard libraries (e.g., prom-client).
Examples
Node.js Exporter using prom-client (metrics.js)
const client = require('prom-client');
const collectDefaultMetrics = client.collectDefaultMetrics;
collectDefaultMetrics({ register: client.register });
const httpRequestsCounter = new client.Counter({
name: 'http_requests_total',
help: 'Total number of HTTP requests',
labelNames: ['method', 'route', 'status']
});
module.exports = {
register: client.register,
httpRequestsCounter
};
// Usage: httpRequestsCounter.inc({ method: 'GET', route: '/users', status: 200 });Decision Criteria
- All Production Services: Export standard metrics for resource usage and latency.
- Custom KPIs: Define custom metrics for critical business events.
Common Mistakes
- Using high-cardinality labels (e.g., user IDs) in metrics, which causes memory bloat.
- Failing to monitor custom business metrics.
Professional Recommendations
Review metrics definitions regularly to keep data structures clean.
Alerting
Purpose
To notify operations teams immediately when system health metrics deviate from normal ranges.
Rules
- Send high-priority alerts only for issues that require immediate attention.
- Include context like system logs or dashboard links in all alert messages.
Workflow
- Define alert rules in Prometheus configurations.
- Configure Alertmanager to handle routing rules.
- Group alerts to avoid sending multiple notifications for the same issue.
- Route notifications to communication channels (e.g., Slack, PagerDuty).
Examples
Prometheus Alert Rules Manifest (alert-rules.yaml)
groups:
- name: application-alerts
rules:
- alert: HTTP5xxRateHigh
expr: sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m])) * 100 > 5
for: 2m
labels:
severity: critical
annotations:
summary: "High HTTP 5xx error rate detected on {{ $labels.instance }}"
description: "HTTP 5xx error rate has exceeded 5% for the last 2 minutes."Alertmanager Routing Configurations (alertmanager.yml)
global:
resolve_timeout: 5m
route:
group_by: ['alertname']
group_wait: 10s
group_interval: 5m
repeat_interval: 1h
receiver: 'slack-notifications'
receivers:
- name: 'slack-notifications'
slack_configs:
- api_url: 'https://hooks.slack.com/services/T00/B00/X00'
channel: '#ops-alerts'
send_resolved: true
title: '{{ .CommonAnnotations.summary }}'
text: '{{ .CommonAnnotations.description }}'Common Mistakes
- Setting alert thresholds too low, causing false alarms.
- Sending warnings to high-priority pager channels, leading to alert fatigue.
Autoscaling
Purpose
To scale infrastructure resources dynamically based on application traffic.
Rules
- Define minimum and maximum replica limits to manage resource costs.
- Base autoscaling triggers on metrics like CPU usage or average request counts.
Workflow
- Enable autoscaling metrics collection (e.g., Metrics Server).
- Configure Horizontal Pod Autoscaler (HPA) manifests defining scaling criteria.
- The autoscaler checks system metrics at set intervals.
- The autoscaler adjusts replica counts dynamically to match demand.
Examples
Horizontal Pod Autoscaling manifest (hpa.yaml)
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: api-autoscaler
namespace: production
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: api-service
minReplicas: 3
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80Decision Criteria
- High-Traffic Web Applications: Use autoscaling to handle traffic spikes.
- Simple Internal Tools: Set static container counts to keep resource usage predictable.
Reverse Proxy
Purpose
To manage incoming traffic, SSL termination, and routing rules at the network edge.
Rules
- Keep connection timeouts configured to prevent slow-client attacks.
- Do not expose upstream application servers directly to the public internet.
Workflow
- Route incoming public traffic to the reverse proxy (e.g., Nginx).
- The proxy terminates SSL connections and validates requests.
- The proxy routes traffic to upstream application servers.
- The proxy returns application responses to clients.
Examples
Secure Nginx Configuration File (nginx.conf)
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# SSL Settings
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256';
# Security Headers
add_header X-Frame-Options "DENY" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Content-Security-Policy "default-src 'self';" always;
upstream app_servers {
server api-service.production.svc.cluster.local:8080;
}
server {
listen 80;
server_name api.production.internal;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name api.production.internal;
ssl_certificate /etc/ssl/certs/production.crt;
ssl_certificate_key /etc/ssl/private/production.key;
location / {
proxy_pass http://app_servers;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 5s;
proxy_read_timeout 60s;
}
}
}CDN
Purpose
To cache and deliver static content globally, reducing load times for users.
Rules
- Set cache expiration headers (Cache-Control) to manage static assets.
- Purge CDN caches automatically during application deployments.
Workflow
flowchart LR
A["User Request"] --> B["CDN Edge Cache"]
B -- Cache Hit --> C["Deliver Static Asset"]
B -- Cache Miss --> D["Fetch from Origin Server"]
D --> E["Cache Asset on Edge"]
E --> CBest Practices
- Serve media files and static scripts via CDNs to reduce server load.
- Compress assets using Brotli or Gzip formats.
Examples
Cloudflare Page Rule Cache configuration (cloudflare.tf)
resource "cloudflare_page_rule" "cache_static" {
zone_id = var.cloudflare_zone_id
target = "example.com/static/*"
status = "active"
priority = 1
actions {
cache_level = "cache_everything"
edge_cache_ttl = 14400 # 4 Hours
browser_cache_ttl = 14400
}
}DNS
Purpose
To translate human-readable domains into IP addresses, routing traffic to application environments.
Rules
- Keep TTL values configured properly to balance update speed against query volumes.
- Enable DNSSEC to prevent cache poisoning attacks.
Workflow
- The user inputs a domain name in the browser.
- The browser queries the DNS server for resolution.
- The DNS server returns the resource record (e.g., A, CNAME).
- The browser routes requests to the resolved IP address.
Examples
Cloudflare Zone DNS Record Template (dns.tf)
resource "cloudflare_record" "api" {
zone_id = var.cloudflare_zone_id
name = "api"
value = "192.0.2.1"
type = "A"
ttl = 300 # 5 Minutes
proxied = true
}
resource "cloudflare_record" "mail_spf" {
zone_id = var.cloudflare_zone_id
name = "@"
value = "v=spf1 ip4:192.0.2.1 -all"
type = "TXT"
ttl = 3600
}SSL
Purpose
To encrypt user connections, securing data transmission between clients and servers.
Rules
- Enforce HTTPS connections and redirect HTTP traffic.
- Configure automatic SSL certificate renewals before expiration dates.
Workflow
- Cert-manager polls for SSL certificates using ACME challenges.
- The issuer generates validated certificates (e.g., Let's Encrypt).
- The issuer stores certificates inside Kubernetes Secrets.
- The Ingress controller mounts the secrets to terminate SSL traffic.
Examples
Cert-Manager Issuer and Ingress Route Configuration (ingress-ssl.yaml)
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: admin@example.com
privateKeySecretRef:
name: letsencrypt-prod-key
solvers:
- http01:
ingress:
class: nginx
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: api-ingress
namespace: production
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-prod"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
ingressClassName: nginx
tls:
- hosts:
- api.example.com
secretName: api-tls-certs
rules:
- host: api.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: api-service
port:
number: 80Backups
Purpose
To capture and store system data periodically, protecting workloads from data loss.
Rules
- Store backup archives in isolated, off-site storage buckets.
- Run automated validation tests to confirm backup files can be restored.
Workflow
- Run automated backup scripts on schedule.
- Compress and encrypt backup files using secure keys.
- Upload backup archives to secure, off-site storage locations.
- Audit database restoration procedures to verify backup validity.
Examples
Secure PostgreSQL Backup script (backup.sh)
#!/usr/bin/env bash
set -euo pipefail
# Environment details
DB_HOST="production-db.internal"
DB_NAME="app_db"
DB_USER="app_user"
BACKUP_DIR="/tmp/backups"
S3_BUCKET="s3://production-database-backups"
TIMESTAMP=$(date +%F-%H%M%S)
BACKUP_FILE="${BACKUP_DIR}/${DB_NAME}-${TIMESTAMP}.sql.gz"
mkdir -p "$BACKUP_DIR"
echo "Creating database backup..."
pg_dump -h "$DB_HOST" -U "$DB_USER" -d "$DB_NAME" | gzip > "$BACKUP_FILE"
echo "Encrypting backup archive..."
gpg --symmetric --batch --passphrase-file /etc/backup-key.txt -o "${BACKUP_FILE}.gpg" "$BACKUP_FILE"
echo "Uploading encrypted backup to S3 storage..."
aws s3 cp "${BACKUP_FILE}.gpg" "${S3_BUCKET}/${DB_NAME}-${TIMESTAMP}.sql.gz.gpg"
echo "Cleaning up local files..."
rm -f "$BACKUP_FILE" "${BACKUP_FILE}.gpg"
echo "Backup process completed successfully."Common Mistakes
- Storing backup files on the same host as the running database.
- Failing to verify backup files by running restore tests.
Disaster Recovery
Purpose
To define the processes for restoring system availability after major outages or data loss.
Rules
- Define Recovery Time Objective (RTO) and Recovery Point Objective (RPO) targets clearly.
- Maintain up-to-date recovery runbooks and update them quarterly.
Workflow
flowchart TD
A["Outage Detected / Declared"] --> B["Initiate Disaster Recovery Plan"]
B --> C["Deploy Infrastructure Core via Terraform to Secondary Region"]
C --> D["Restore Database State from Latest S3 Backup"]
D --> E["Run Database Sanity and Consistency Checks"]
E --> F["Update DNS Records to point to Secondary Region"]
F --> G["Post-Recovery Verification & Monitoring"]Best Practices
- Replicate database records to a standby region asynchronously.
- Run automated disaster recovery exercises to verify processes and train operators.
Decision Criteria
- Critical Systems: Multi-region active-passive setup with automatic failover.
- Non-critical Systems: Cold standby with automated restoration from backups.
High Availability
Purpose
To design infrastructure components that survive hardware and network failures without downtime.
Rules
- Avoid single points of failure by deploying redundant resources across different environments.
- Enforce health checking and automatic failovers on all load balancers.
Workflow
- Deploy application instances across multiple Availability Zones.
- Place instances behind redundant load balancers.
- Configure databases to run in primary-standby configurations with automatic failover.
- The system routes traffic to healthy nodes, isolating failed instances automatically.
Examples
AWS Auto Scaling Group and Multi-AZ Subnets (ha.tf)
resource "aws_launch_template" "app" {
name_prefix = "ha-app-template-"
image_id = "ami-0c7217cdde317cfec" # Example AMI
instance_type = "t3.medium"
network_interfaces {
associate_public_ip_address = false
security_groups = [var.app_security_group_id]
}
user_data = base64encode(<<-EOF
#!/bin/bash
echo "Starting App Service..."
EOF
)
}
resource "aws_autoscaling_group" "app_asg" {
vpc_zone_identifier = [var.subnet_az1_id, var.subnet_az2_id, var.subnet_az3_id]
desired_capacity = 3
max_size = 6
min_size = 3
launch_template {
id = aws_launch_template.app.id
version = "$Latest"
}
target_group_arns = [var.target_group_arn]
health_check_type = "ELB"
health_check_grace_period = 300
}Common Mistakes
- Placing all application servers inside a single availability zone.
- Forgetting to test database failover behavior under load.
Cloud Architecture
Purpose
To organize cloud components, ensuring environments are secure, scalable, and manageable.
Rules
- Keep cloud subnets isolated, separating public ingress points from private database layers.
- Limit administrative network access to secure jump boxes or client VPN connections.
Workflow
flowchart TD
A["Public internet Traffic"] --> B["Internet Gateway / WAF"]
B --> C["Application Load Balancer (Public Subnet)"]
C --> D["Application Pods / Workers (Private Subnet)"]
D --> E["Database Primary / Standby (Isolated Data Subnet)"]Best Practices
- Enforce security groups to restrict traffic flow to minimum necessary pathways.
- Connect to cloud resources using VPC endpoints to keep traffic within internal networks.
Examples
AWS 3-Tier Network Module Configuration (network.tf)
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "5.5.0"
name = "production-vpc"
cidr = "10.0.0.0/16"
azs = ["us-east-1a", "us-east-1b", "us-east-1c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
database_subnets = ["10.0.201.0/24", "10.0.202.0/24", "10.0.203.0/24"]
enable_nat_gateway = true
single_nat_gateway = false
one_nat_gateway_per_az = true
create_database_subnet_group = true
tags = {
Environment = "production"
Team = "platform-operations"
}
}Cost Optimization
Purpose
To monitor and manage cloud resource usage, minimizing costs without degrading performance.
Rules
- Tag all cloud resources to track and allocate costs to specific environments or teams.
- Terminate unused or orphaned resources (e.g., detached disks, outdated snapshots) on schedule.
Workflow
- Track cloud resource usage using monitoring tools.
- Right-size server resources (CPU, memory) to match actual workloads.
- Configure instances to run on lower-cost Spot or preemptible servers where appropriate.
- Automate shutdown schedules for development and staging environments.
Examples
Auto-shutdown Script for Dev instances (cleanup.py)
import boto3
ec2 = boto3.client('ec2', region_name='us-east-1')
def lambda_handler(event, context):
# Locate active instances tagged as non-persistent dev resources
filters = [
{'Name': 'tag:Environment', 'Values': ['development']},
{'Name': 'instance-state-name', 'Values': ['running']}
]
response = ec2.describe_instances(Filters=filters)
instance_ids = []
for reservation in response['Reservations']:
for instance in reservation['Instances']:
instance_ids.append(instance['InstanceId'])
if instance_ids:
print(f"Stopping instances: {instance_ids}")
ec2.stop_instances(InstanceIds=instance_ids)
else:
print("No running development instances found.")Common Mistakes
- Keeping oversized instances running continuously for idle workloads.
- Leaving detached storage volumes active after deleting server instances.
Security Best Practices
Purpose
To protect infrastructure components and user data from security threats and access violations.
Rules
- Enforce the Principle of Least Privilege on all access policies.
- Run security vulnerability scans on application containers before deployment.
Workflow
flowchart TD
A["Define Secure Policies (IAM Roles)"] --> B["Isolate Networks (VPCs & Firewalls)"]
B --> C["Encrypt Data at Rest and in Transit"]
C --> D["Scan Container Images for CVEs"]
D --> E["Audit and Log Access Attempts"]Examples
AWS IAM Least-Privilege Policy (policy.json)
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::production-app-assets/*"
}
]
}Kubernetes NetworkPolicy Manifest (network-policy.yaml)
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: database-isolation
namespace: production
spec:
podSelector:
matchLabels:
app: postgres-db
policyTypes:
- Ingress
ingress:
- from:
- podSelector:
matchLabels:
app: backend-api
ports:
- protocol: TCP
port: 5432Performance
Purpose
To track, evaluate, and optimize application throughput, latency, and resource efficiency.
Rules
- Define and enforce performance budgets (e.g., API response times under 200ms) inside test pipelines.
- Verify scaling actions do not exceed database connection limits.
Workflow
- Define load testing metrics and criteria.
- Run automated load tests (e.g., k6) in the staging environment.
- Monitor system latencies, error rates, and bottlenecks.
- Optimize application configurations and resources to meet requirements.
Examples
Load Testing script using k6 (load-test.js)
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
{ duration: '1m', target: 50 }, // Scale up to 50 users
{ duration: '3m', target: 50 }, // Maintain load
{ duration: '1m', target: 0 }, // Scale down
],
thresholds: {
http_req_duration: ['p(95)<200'], // 95% of requests must complete under 200ms
http_req_failed: ['rate<0.01'], // Error rate must be under 1%
},
};
export default function () {
const res = http.get('http://api-service.staging.internal/health/live');
check(res, {
'status is 200': (r) => r.status === 200,
});
sleep(1);
}Common Mistakes
- Tuning container parameters without executing load tests to verify performance.
- Relying on local development metrics to predict production performance.
Debugging
Purpose
To locate, analyze, and resolve errors or bottlenecks in application and infrastructure components.
Rules
- Do not run debugging tools directly in production environments unless they are isolated from user traffic.
- Document and log all administrative actions taken during debugging runs.
Workflow
- Trace client request issues using unique correlation IDs.
- Fetch logs from target application pods or servers.
- Inspect network connectivity and system parameters.
- Replicate the issue in the staging environment to analyze and test solutions.
Examples
Kubernetes Debugging Run commands (debug.sh)
#!/usr/bin/env bash
# Useful diagnostic command references
# 1. Fetch real-time container logs with timestamp markers
kubectl logs -n production deployment/api-service --tail=100 --timestamps
# 2. Spin up an ephemeral debugging container inside a running pod
kubectl debug -it -n production pod/api-service-84f98d-abcde \
--image=nicolaka/netshoot --target=application
# 3. View events inside a namespace ordered by creation time
kubectl get events -n production --sort-by='.metadata.creationTimestamp'
# 4. View ingress controller traffic metrics in real-time
kubectl logs -n ingress-nginx deployment/ingress-nginx-controller -fIncident Response
Purpose
To guide the coordination and resolution of production outages, minimizing downtime and data loss.
Rules
- Keep communication channels updated with progress reports during active incidents.
- Conduct a post-mortem review after resolving critical incidents to plan preventative upgrades.
Workflow
flowchart TD
A["Incident Detected / Alert Triggered"] --> B["Page On-Call SRE"]
B --> C["Triage: Identify Scope & Impact"]
C --> D["Mitigate: Apply Temporary Patch / Rollback"]
D --> E["Resolve: Confirm Metrics Return to Normal"]
E --> F["Post-Mortem: Document Incident and Fix"]Best Practices
- Focus on mitigation (restoring service) before deep-diving into root causes.
- Document incident events in centralized timelines.
Examples
SEV-1 Outage Timeline Template (incident.md)
# Incident Report: SEV-1 API Outage
## Status
- **Incident Commander:** SRE On-Call
- **Status:** Resolved
- **Impact Duration:** 25 Minutes (14:10 - 14:35 UTC)
## Timeline (UTC)
- **14:10** - Alert `HTTP5xxRateHigh` triggers on Slack.
- **14:12** - On-Call SRE joins the incident bridge.
- **14:15** - Ephemeral pod logs show database connection timeout exceptions.
- **14:20** - CPU utilization on RDS DB instance hits 100%. Slow query logs pinpoint an unindexed search endpoint.
- **14:25** - Rollback deployment to v1.2.0, disabling the unindexed search endpoint.
- **14:30** - DB CPU drops to 15%; error rates return to normal baseline.
- **14:35** - Incident declared resolved.Runbooks
Purpose
To provide operators with step-by-step instructions for troubleshooting and resolving common system alerts.
Rules
- Keep runbooks updated with commands and paths.
- Write instructions clearly to enable quick execution during stressful incidents.
Workflow
- Receive system alert (e.g., HostDiskSpaceLow).
- Open the corresponding runbook for instructions.
- Run diagnostic commands to identify issues.
- Execute mitigation commands (e.g., cleaning logs, scaling resources) to resolve the alert.
- Verify system metrics return to normal ranges.
Examples
Troubleshooting Runbook: Disk Space Exhaustion (runbook_disk.md)
# Runbook: Troubleshoot Host Disk Space Low Alert
## Symptoms
Alert `HostDiskSpaceLow` triggers. Host disk utilization exceeds 90%.
## Diagnostics
1. SSH into target host and identify large folders:
```bash
df -h
du -sh /var/log/*- Locate old or rotated log archives:
find /var/log -type f -name "*.gz" -mtime +7
Mitigation
- Clear docker cache files safely:
docker system prune -a --volumes --force - Delete rotated log files older than 7 days:
find /var/log -type f -name "*.gz" -mtime +7 -delete - Restart logrotate service to verify it runs correctly:
logrotate -f /etc/logrotate.conf
---
## Common Mistakes
### Purpose
To list common DevOps engineering mistakes, helping teams avoid configuration issues and stability risks.
### Rules
- Never bypass linting or security checks in release pipelines.
- Verify security configurations before deploying updates.
### Workflow
```mermaid
flowchart TD
A["Identify Common Mistakes"] --> B["Insecure configuration check"]
B --> C["Missing resource limits check"]
C --> D["Wildcard network access check"]
D --> E["Manual configuration drift check"]Best Practices
- Run automated security checks inside build pipelines.
- Audit configurations periodically to identify and correct security gaps.
Common Mistakes & Remediation
- Mistake: Committing API keys to repositories.
- Remediation: Remove keys and load them using secure key vaults.
- Mistake: Deploying pods without CPU/Memory limits.
- Remediation: Enforce resource requests and limits in deployment manifests.
- Mistake: Logging into production servers to apply configuration patches manually.
- Remediation: Automate all infrastructure changes using IaC.
Anti Patterns
Purpose
To identify and avoid infrastructure design patterns that harm stability, scalability, and security.
Rules
- Avoid manual configuration changes on production servers (Configuration Drift).
- Avoid single-instance deployments for critical production services.
Workflow
flowchart TD
A["Scan Infrastructure for Anti-Patterns"] --> B["Locate manual configuration drift on server nodes"]
B --> C["Refactor using version-controlled IaC templates"]
C --> D["Locate single point of failure server nodes"]
D --> E["Refactor to use high-availability multi-instance setups"]Best Practices
- Build new container images for every deployment instead of modifying active servers.
- Parameterize configuration values to support clean environment reuse.
Common Mistakes
- Using local storage on server instances, preventing horizontal scaling.
- Hardcoding passwords in compose configuration files.
Decision Criteria
- Production Infrastructure: Enforce IaC automation, container orchestration, and multi-region backups.
- Local Development: Use local compose setups.
Professional Recommendations
Perform monthly infrastructure audits to identify and resolve anti-patterns.
Engineering Checklist
Purpose
To provide a final review checklist, ensuring all infrastructure and pipeline updates meet security, performance, and quality standards before release.
Rules
- All infrastructure changes must pass the engineering checklist before code is deployed to production.
- Document any checklist violations and resolve them in immediate sprint cycles.
Checklist
- Infrastructure as Code: All infrastructure changes are defined in version-controlled templates.
- Secrets Security: Credentials and API keys are stored in secure key vaults; no secrets are committed to git.
- Docker Safety: Container builds are optimized using multi-stage Dockerfiles and run with non-root privileges.
- Resource Limits: Pod deployments configure CPU and memory requests and limits.
- CI/CD Automation: Deployment pipelines are automated, cached, and pass lint and test stages.
- Security: VPC subnets are isolated, ports are secured, and SSL/TLS is enforced.
- Observability: Prometheus metrics, structured JSON logging, and trace logs are active.
- Autoscaling: Horizontal pod autoscalers (HPA) are configured.
- High Availability: Resources deploy across multiple availability zones; database replicas are configured.
- Backups & Recovery: Automatic daily backups are active, and restore tests pass weekly.
Self Review Engine
Purpose
To define a self-criticism engine that forces the AI to audit its infrastructure designs and configurations before returning code.
Rules
- Before outputting any infrastructure template or container configuration, analyze the draft against the self-review metrics (Simplicity, Security, Performance, Observability, Cost).
- Refactor and correct any identified violations before returning the final response.
Workflow
flowchart TD
Start["Draft Manifest/IaC Completed"] --> Q1{"Is root user used in container?"}
Q1 -- Yes --> R1["Refactor using USER non-root directives"] --> Q2
Q1 -- No --> Q2{"Are CPU/Memory limits configured?"}
Q2 -- Yes --> R2["Inject resource requests and limits"] --> Q3
Q2 -- No --> Q3{"Are secrets committed to templates?"}
Q3 -- Yes --> R3["Refactor to pull secrets from key vaults or environment variables"] --> Q4
Q3 -- No --> Q4{"Are health checks configured?"}
Q4 -- Yes --> R4["Inject liveness and readiness probes"] --> Q5
Q4 -- No --> Q5{"Is SSL/TLS termination active?"}
Q5 -- Yes --> R5["Configure HTTPS redirects and cert rotation rules"] --> End
Q5 -- No --> End["Deliver Final Secure Infrastructure Manifest"]Best Practices
- Treat the self-review engine as a required step in the infrastructure design pipeline.
- Document and update check criteria based on feedback from security and operations teams.
Common Mistakes
- Returning manifest designs without passing through the self-review checks.
- Assuming the first template version is always secure and optimal.
Decision Criteria
Apply the self-review engine to all infrastructure and configuration tasks.
Examples
- Self-Review Audit: Noticing that a container configuration lacked CPU/memory limit configurations, leading to a resource limits refactor before returning the code.
Professional Recommendations
Configure your linting pipelines to run automated syntax and security audits.
References
Purpose
To list core specifications, documentation, and technical resources that govern DevOps engineering standards.
Recommended References
- Terraform Registry Documentation: AWS, GCP, and Kubernetes provider guides.
- Docker Reference Guide: Best practices for writing Dockerfiles and Compose files.
- Kubernetes Documentation: Deployments, services, HPA, and security context guidelines.
- OWASP Docker Security Cheat Sheet: Essential security practices to secure container deployments.
- Google SRE Workbook: Authoritative guide to SLIs, SLOs, and incident mitigation strategies.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

