Devops How To Learn

Devops How To Learn

Reading time1 min
#DevOps#Cloud#Automation#CI/CD#Kubernetes#Terraform

Mastering DevOps: A Pragmatic Engineer’s Learning Guide

Endlessly chasing every emerging DevOps tool will keep you in a perpetual state of onboarding. Instead, focus on core competencies, underpinned by hands-on projects that mirror production realities.


1. Groundwork: DevOps Principles Are Not Optional

DevOps isn’t tools—it’s the set of practices enabling rapid, reliable value delivery. Ignore the hype, learn the following tenets:

  • Cross-discipline collaboration (Dev, Ops, QA, Security)
  • Automation as a default (builds, tests, infra provisioning)
  • Continuous Integration / Continuous Deployment pipelines (CI/CD)
  • Infrastructure as Code (IaC), immutable infrastructure
  • Monitoring, observability, feedback loops

Key resources:

  • The Phoenix Project (Gene Kim)
  • Site Reliability Engineering (Google SRE Book)
  • devopsdays.org

Note: Most “DevOps problems” are people and process challenges, not the absence of a tool.


2. Linux, Shell, and Scripting: Non-Negotiable Skills

DevOps teams nearly always operate on Linux. Proficiency in command-line tools and scripting saves hours daily.

Essential commands:
ps, top, netstat, ss, journalctl, find, awk, sed

Automate: Daily backup rotation

#!/bin/bash
# /usr/local/bin/rotate-backup.sh

SRC_DIR="/srv/app-data"
BACKUP_DIR="/backups/app"
TS=$(date +%Y%m%d%H%M%S)
mkdir -p "$BACKUP_DIR"
tar --exclude='*.cache' -czf "$BACKUP_DIR/app-$TS.tar.gz" "$SRC_DIR"
find "$BACKUP_DIR" -type f -mtime +14 -exec rm {} \;

# Log output
echo "$(date): Backup completed" >> /var/log/app-backup.log

Expect permissions issues (Permission denied), especially with systemd timers. Debug with sudo and file ACL checks.


3. Version Control Deep Dive: Git Beyond Basics

Version control isn’t just for devs. Confident use of Git (2.34+ recommended) is mandatory for pipeline code, configuration, even documentation.

Focus:

  • Branching strategies (git-flow, trunk-based)
  • Interactive rebasing (git rebase -i HEAD~5)
  • Resolving tricky merge conflicts

Tip: When resolving a messy merge, don't apply blind git checkout --theirs. Read the diff, especially for YAML where indentation errors cause deployment failures. Maintain your .gitignore religiously—accidental secrets in version control are common, and nearly always a root cause in audits.

Real-world scenario:

$ git push origin main
remote: error: GH006: Protected branch update failed for refs/heads/main.
remote: error: Required status check "ci/build" is failing.

Pipeline gating: Fix CI before merging, or you'll block all downstream deploys.


4. Building Practical CI/CD Pipelines

The core of DevOps: build automation. Tools vary (Jenkins 2.387, GitHub Actions, GitLab CI, Drone), but patterns align.

Minimum viable pipeline:

  • build: Compile and package app (go build, npm ci && npm run build)
  • test: Run unit tests; fail fast on red
  • lint: Enforce code style
  • artifacts: Store build outputs
  • deploy: Push to staging (optional)

Example: GitHub Actions workflow for a Node app (.github/workflows/ci.yml)

name: CI

on:
  push:
    branches: [main]

jobs:
  build-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run: npm ci
      - run: npm test

Add notifications: Use actions/slack for pipeline results; missed alerts are a silent killer of fast recovery.

Known gotcha:
Build caches often accumulate gigabytes in worker nodes. Regular cache cleaning (gh cache delete, Jenkins workspace cleanup) prevents disk-outage failures.


5. Infrastructure as Code: Reproducible, Auditable Environments

Cloud APIs (AWS, Azure, GCP) and config drift demand IaC. Learn Terraform (≥1.3) for infra provisioning; Ansible (≥2.11) or equivalent for config management.

Example: Deploying an EC2 instance (AWS provider v5.x):

provider "aws" {
  region = "us-west-2"
}

resource "aws_instance" "nginx" {
  ami           = "ami-0e472ba40eb589f49" # Amazon Linux 2023
  instance_type = "t3.micro"
  user_data     = file("install-nginx.sh")
  tags = { Name = "nginx-demo" }
}

Provision with:

terraform init && terraform apply

Typically, you’ll hit AWS API throttling at scale. Use lifecycle { create_before_destroy = true } for zero-downtime swaps. Always commit your Terraform state encryption settings.

Side note:
Never store cloud secrets or private keys directly in code—use tools like AWS SSM Parameter Store or HashiCorp Vault.


6. Containers and Orchestration: Docker to Kubernetes

Static VMs don’t scale. Docker (≥24) is fundamental (writing Dockerfiles, optimizing multi-stage builds). Compose multi-container setups with Docker Compose 2.x.

Then: Kubernetes (v1.28+). Don’t start in prod—use Minikube or Kind.

Skills:

  • Container networking (bridge vs host)
  • Volumes & config via ConfigMaps/Secrets
  • Basic manifests: Deployment, Service, Ingress

Mini-project:

  • Containerize a REST API (Node or Go)
  • Deploy to local K8s with PersistentVolume for storage
  • Expose via Ingress to simulate production L7 routing

Common error:

CrashLoopBackOff
Readiness probe failed: HTTP probe failed with statuscode: 503

Mismatch between app startup and probe configuration is frequent—tune initial delays.

Tune for dev:
Keep your YAMLs under 200 lines. Use kustomize or Helm (≥v3.13) for templating once you need environment overlays.


7. Continuous Deployment and Observability

Automation must include safe delivery to production and post-deployment feedback.

  • Implement staged deployments with rollout strategies (kubectl rollout status, Helm rolling update)
  • Write simple Helm charts for repeatability
  • Integrate monitoring tooling (Prometheus v2.47+, Grafana v10)

Quick script: Alert on high CPU

# PrometheusRule
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: high-cpu
spec:
  groups:
    - name: node.rules
      rules:
      - alert: HighCpuLoad
        expr: avg(rate(node_cpu_seconds_total{mode="system"}[5m])) by (instance) > 0.7
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: "CPU load is high on {{ $labels.instance }}"

Trade-off:
Excessive alerting induces alert fatigue. Balance thresholds and use dashboards for context, not just numbers.


Practical Tips (From the Field):

  1. Build layered mini-projects: Not just “Hello World”. Try a To-Do webapp with Docker Compose, pipeline, IaC—end to end.
  2. Write runbooks: Document deployment and rollback steps in README or as markdown in repo.
  3. Join active communities: #devops on Slack, Reddit’s r/devops—real-world issues appear daily.
  4. Deliberately break things: Introduce misconfigurations. Practice root cause analysis (RCA).
  5. Invest in troubleshooting: Master reading logs (kubectl logs, journalctl -xe, docker inspect), parse stack traces, trace failed build artifacts back through systems.

Alternative exists: Some shops now use Pulumi (TypeScript IaC) or Crossplane, but 80% of jobs still demand Terraform/Ansible/Shell.


Final Word

The path to DevOps mastery isn’t a shopping list of tools. Learn core systems, automate everything real, and integrate production-grade feedback loops. Production is where good intentions fail (or succeed); make your test rigs match the chaos of reality.

Build incrementally. When in doubt, trace the problem deeper than the UI. Eventually, you’ll solve not just technical issues, but whole-team bottlenecks.

No secret sauce—just deliberate, sometimes messy, practice.