Concepts

Concepts

Master essential DevOps concepts with practical examples and detailed explanations

118 Core Concepts
200 Tricky Questions
10 Topics

Filter by Topic

Linux

13 concepts β€’ 20 questions

What is Linux?

Linux is a free, open-source operating system kernel created by Linus Torvalds in 1991. Born from a university project, it has evolved into the foundation of modern computing infrastructure. Major distributions include Ubuntu (user-friendly), Red Hat Enterprise Linux (enterprise), CentOS (community enterprise), Debian (stable), and Alpine (lightweight). Linux powers 96.3% of the world's top 1 million web servers, 100% of supercomputers, and billions of Android devices. It's essential for DevOps because it enables containerization (Docker/Kubernetes), cloud computing (AWS/Azure/GCP), automation scripting, and provides the stable, secure foundation for CI/CD pipelines. Think of Linux like a universal translator for computers - it helps different software programs talk to the hardware, just like how a translator helps people who speak different languages communicate with each other.

Learning Sections

Choose your learning path

Basic Commands

Essential navigation, inspection and search tools: ls, cd, pwd, cat, less, grep, find, locate, which, man.

Topics
linuxbasicscommandsnavigation

Code Examples

(4)
terminal
$ ls -la
Show all files with detailed permissions and sizes
terminal
$ cd /home && pwd
Navigate to home directory and show current path
terminal
$ grep 'error' app.log
Search for 'error' in application log file
terminal
$ find . -name '*.txt'
Find all .txt files in current directory

More Commands

(17)

File Permissions & Ownership

r/w/x for user, group, others; chmod, chown, umask; symbolic vs numeric (e.g. 754).

Topics
linuxpermissionssecurityownership

Code Examples

(4)
terminal
$ chmod 755 myscript.sh
Make script executable (owner can run, others can read)
terminal
$ chmod 644 config.txt
Set file as readable/writable for owner, readable for others
terminal
$ chown user:group myfile.txt
Change file owner to 'user' and group to 'group'
terminal
$ ls -l myfile.txt
Check current permissions and ownership of a file

More Commands

(14)

Filesystem Structure

Key directories: /etc configs, /var variable data, /usr user apps, /opt optional, /tmp temp, /proc kernel view.

Topics
linuxfilesystemFHSdirectories

Code Examples

(4)
terminal
$ ls /var/log
List log files directory (important for troubleshooting)
terminal
$ cd /etc && ls
Navigate to config directory and see system files
terminal
$ ls /home
View user home directories
terminal
$ df -h
Check disk space usage (prevent storage issues)

Process Management

Observe & control processes: ps, top/htop, kill, nice/renice, jobs & foreground/background.

Topics
linuxprocessmonitoringsignals

Code Examples

(4)
terminal
$ ps aux
Show all running processes with details
terminal
$ top
Display real-time process activity and resource usage
terminal
$ kill 1234
Terminate process with ID 1234 gracefully
terminal
$ jobs
List active background jobs in current shell

More Commands

(11)

Shell Scripting Basics

Bash scripting fundamentals: variables, loops, conditionals, functions, and automation examples.

Topics
linuxbashscriptingautomation

Code Examples

(4)
terminal
$ #!/bin/bash
echo "Deployment started"
Basic script header and output message
terminal
$ APP_NAME="myapp"
echo "Deploying $APP_NAME"
Use variables for app names and environments
terminal
$ if [ -f app.log ]; then
  echo "Log file found"
fi
Check if log file exists before processing
terminal
$ for server in web1 web2 web3; do
  echo "Checking $server"
done
Loop through multiple servers for deployment

System Services & Init Systems

Managing services with systemd: systemctl commands, unit files, service states, and startup configuration.

Topics
linuxsystemdservicesinit

Code Examples

(4)
terminal
$ systemctl status nginx
Check if web server is running (common DevOps task)
terminal
$ systemctl restart docker
Restart Docker service after configuration changes
terminal
$ systemctl enable nginx
Enable service to start automatically on boot
terminal
$ systemctl logs nginx
View service logs for troubleshooting

Logging & Monitoring

System logging with syslog, journalctl, log rotation, and monitoring tools for system health.

Topics
linuxloggingmonitoringsyslog

Code Examples

(4)
terminal
$ tail -f /var/log/nginx/error.log
Watch web server errors in real-time
terminal
$ grep "ERROR" /var/log/app.log
Find application errors in log file
terminal
$ journalctl -u docker
View Docker service logs
terminal
$ tail -100 /var/log/syslog
View last 100 system log entries

More Commands

(10)

Cron Jobs & Scheduling

Task automation with cron: crontab syntax, scheduling patterns, and systemd timers as modern alternative.

Topics
linuxcronschedulingautomation

Code Examples

(4)
terminal
$ crontab -l
List all scheduled jobs (check what's automated)
terminal
$ crontab -e
Edit cron jobs (add new automated tasks)
terminal
$ 0 2 * * * /backup/backup.sh
Run backup script every night at 2 AM
terminal
$ */5 * * * * /health/check.sh
Run health check every 5 minutes

Security Fundamentals

Linux security basics: user management, sudo configuration, firewall rules, and system hardening practices.

Topics
linuxsecurityhardeningfirewall

Code Examples

(4)
terminal
$ sudo adduser newuser
Create a new user account
terminal
$ sudo passwd username
Change password for a user
terminal
$ sudo ufw status
Check firewall status and rules
terminal
$ who
See who is currently logged into the system

More Commands

(16)

Virtualization & Containers

Understanding VMs vs containers, Linux namespaces, cgroups, and container runtime fundamentals.

Topics
linuxcontainersvirtualizationdocker

Code Examples

(4)
terminal
$ docker ps
List running containers (check what's active)
terminal
$ docker images
Show available Docker images
terminal
$ docker logs myapp
View container logs for troubleshooting
terminal
$ docker exec -it myapp bash
Access running container shell for debugging

Performance Tuning

System performance analysis and optimization: monitoring tools, kernel parameters, and bottleneck identification.

Topics
linuxperformancetuningmonitoring

Code Examples

(4)
terminal
$ htop
Interactive process viewer showing CPU and memory usage
terminal
$ free -h
Show memory usage in human-readable format
terminal
$ uptime
Show system uptime and load average
terminal
$ df -h
Check disk space usage for all mounted filesystems

More Commands

(12)

Networking & Connectivity

Network configuration, connectivity testing, and troubleshooting tools for DevOps networking tasks.

Topics
linuxnetworkingconnectivitytroubleshooting

Code Examples

(4)
terminal
$ ping -c 4 8.8.8.8
Test connectivity to Google DNS with 4 packets
terminal
$ curl -I https://example.com
Get HTTP headers from website
terminal
$ ss -tulpen
Show all listening ports and connections
terminal
$ dig A example.com +short
Quick DNS lookup for A record

More Commands

(17)

Storage & Filesystems

Disk management, filesystem operations, and storage troubleshooting for system administration.

Topics
linuxstoragefilesystemlvm

Code Examples

(4)
terminal
$ lsblk -f
Show block devices with filesystem information
terminal
$ df -h
Display filesystem usage in human-readable format
terminal
$ sudo mount /dev/xvdf1 /data
Mount device to directory
terminal
$ du -sh * | sort -h
Show directory sizes sorted by size

More Commands

(16)

Docker

13 concepts β€’ 20 questions

What is Docker?

Docker is a containerization platform that packages applications and their dependencies into lightweight, portable containers. It revolutionizes software deployment by ensuring consistency across different environments - from development to production. Docker eliminates 'it works on my machine' problems by creating isolated, reproducible environments. Core concepts include images, containers, Dockerfiles, volumes, networks, and registries for efficient application lifecycle management.

Learning Sections

Choose your learning path

Docker Architecture

Daemon (dockerd), REST API, CLI client, and registries (Docker Hub / private).

Topics
dockerarchitecture

Code Examples

(4)
terminal
$ docker info
Show daemon status, storage driver, and system info
terminal
$ docker version
Display client and server API versions
terminal
$ docker system df
Show Docker disk usage (images, containers, volumes)
terminal
$ docker system prune -a
Clean up unused images, containers, networks, and build cache

Images vs Containers

Images = immutable layered filesystem; containers = runtime instance with writable layer & process namespace.

Topics
dockerimagescontainers

Code Examples

(4)
terminal
$ docker images
List all available Docker images
terminal
$ docker ps
Show currently running containers
terminal
$ docker ps -a
Show all containers (running and stopped)
terminal
$ docker run nginx
Create and start a container from nginx image

Dockerfile Instructions

Core directives: FROM, COPY vs ADD, RUN, CMD, ENTRYPOINT, ENV, EXPOSE, WORKDIR, USER, HEALTHCHECK.

Topics
dockerdockerfileinstructions

Code Examples

(4)
terminal
$ FROM node:18-alpine
Start with Node.js base image
terminal
$ WORKDIR /app
Set working directory inside container
terminal
$ COPY package.json .
Copy package file to container
terminal
$ RUN npm install
Install application dependencies

Volumes & Bind Mounts

Volumes managed by Docker; bind mounts map host paths directly. Persistence & portability differ.

Topics
dockerstoragevolumes

Code Examples

(4)
terminal
$ docker volume create mydata
Create a named volume for data storage
terminal
$ docker run -v mydata:/app/data nginx
Mount volume to container directory
terminal
$ docker run -v $(pwd):/app nginx
Mount current directory to container
terminal
$ docker volume ls
List all Docker volumes

Docker Networking

Default bridge, host, none, user-defined bridge, overlay (Swarm), macvlan for L2 integration.

Topics
dockernetworking

Code Examples

(4)
terminal
$ docker network ls
List all Docker networks
terminal
$ docker network create mynetwork
Create a custom network
terminal
$ docker run --network mynetwork nginx
Run container on custom network
terminal
$ docker run -p 8080:80 nginx
Map container port 80 to host port 8080

Multi-stage Builds

Use multiple FROM stages to build artifacts then copy only what you needβ€”shrinks final image.

Topics
dockerbuildoptimization

Code Examples

(1)
terminal
$ FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
FROM node:20-alpine
WORKDIR /app
COPY --from=build /app/dist ./dist
CMD ["node", "dist/index.js"]
Two-stage build copying only compiled output

Image Tagging & Versioning

Tags are mutable pointers; digests (sha256) are immutable. Pin for reproducibility.

Topics
dockerimagesversioning

Code Examples

(2)
terminal
$ docker pull nginx:1.27-alpine
Pull specific version variant
terminal
$ docker inspect --format='{{.RepoDigests}}' nginx:1.27-alpine
Get immutable digest

Container Logs

'docker logs' reads stdout/stderr from default logging driver (json-file, fluentd, etc.).

Topics
dockerlogging

Code Examples

(2)
terminal
$ docker logs -f --tail=50 api
Follow last 50 lines of a container
terminal
$ docker run --log-driver json-file --log-opt max-size=10m myimg
Configure log rotation

Container Lifecycle Management

Creating, starting, stopping, restarting, and removing containers with proper resource management.

Topics
dockerlifecyclemanagement

Code Examples

(5)
terminal
$ docker run -d --name web --restart=unless-stopped --memory=512m --cpus=0.5 nginx
Run container with resource limits and restart policy
terminal
$ docker exec -it web /bin/bash
Execute interactive shell in running container
terminal
$ docker stop --time=30 web
Gracefully stop container with 30s timeout
terminal
$ docker stats web
Monitor real-time resource usage
terminal
$ docker update --memory=1g --cpus=1.0 web
Update resource limits on running container

Security Best Practices

Container security: non-root users, image scanning, secrets management, and runtime protection.

Topics
dockersecuritybest-practices

Code Examples

(5)
terminal
$ docker run --user 1001:1001 --read-only --tmpfs /tmp nginx
Run as non-root with read-only filesystem
terminal
$ docker run --cap-drop=ALL --cap-add=NET_BIND_SERVICE nginx
Drop all capabilities except port binding
terminal
$ trivy image nginx:latest
Scan image for vulnerabilities
terminal
$ docker secret create db_password password.txt
Create Docker secret from file
terminal
$ docker run --security-opt=no-new-privileges nginx
Prevent privilege escalation

Performance Optimization

Image size reduction, build optimization, runtime performance tuning, and resource management.

Topics
dockerperformanceoptimization

Code Examples

(5)
terminal
$ docker build --target production --build-arg BUILDKIT_INLINE_CACHE=1 .
Multi-stage build with inline cache
terminal
$ docker system df -v
Detailed disk usage breakdown
terminal
$ docker build --cache-from myapp:latest --tag myapp:new .
Use existing image as cache source
terminal
$ docker run --memory=512m --oom-kill-disable=false myapp
Set memory limit with OOM protection
terminal
$ docker image prune -a --filter 'until=24h'
Clean up images older than 24 hours

Registry Management

Working with Docker registries: pushing, pulling, authentication, and private registry setup.

Topics
dockerregistrydistribution

Code Examples

(5)
terminal
$ docker tag myapp:latest registry.company.com/myapp:v1.2.3
Tag image for private registry
terminal
$ docker push registry.company.com/myapp:v1.2.3
Push tagged image to private registry
terminal
$ docker login -u username registry.company.com
Authenticate with private registry
terminal
$ docker manifest inspect nginx:latest
Inspect image manifest and layers
terminal
$ docker search --limit 5 --filter stars=100 nginx
Search Docker Hub for popular nginx images

Docker Compose Basics

Compose orchestrates multi-container apps via declarative YAML (services, networks, volumes).

Topics
dockercompose

Code Examples

(2)
terminal
$ docker compose up -d
Start defined services detached
terminal
$ docker compose ps
List compose-managed containers

Kubernetes

19 concepts β€’ 20 questions

What is Kubernetes?

Kubernetes (K8s) is an orchestration platform that automates the deployment, scaling, and management of containerized applications across clusters of machines. It provides service discovery, load balancing, automated rollouts/rollbacks, and self-healing capabilities. Kubernetes abstracts infrastructure complexity, enabling teams to focus on application logic while ensuring high availability, scalability, and resource efficiency in cloud-native environments.

Learning Sections

Choose your learning path

What is Kubernetes?

Open-source container orchestration platform that automates deployment, scaling, and management of containerized applications.

Topics
kubernetesintroduction

Code Examples

(2)
terminal
$ kubectl version --client
Check kubectl client version
terminal
$ kubectl cluster-info
Display cluster information

Kubernetes Architecture

Master-worker architecture with control plane managing cluster state and worker nodes running workloads.

Topics
kubernetesarchitecture

Code Examples

(3)
terminal
$ kubectl get nodes
List all cluster nodes
terminal
$ kubectl get pods
List pods in current namespace
terminal
$ kubectl get all
Show all resources in namespace

Pods - The Atomic Unit

Smallest deployable unit containing one or more containers sharing network and storage, representing a single instance of an application.

Topics
kubernetespods

Code Examples

(4)
terminal
$ kubectl run nginx --image=nginx
Create a simple nginx pod
terminal
$ kubectl get pods
List all pods
terminal
$ kubectl logs nginx
View pod logs
terminal
$ kubectl delete pod nginx
Delete a pod

Deployments & ReplicaSets

Deployments manage ReplicaSets for declarative updates, scaling, and rollbacks of stateless applications.

Topics
kubernetesdeployments

Code Examples

(4)
terminal
$ kubectl create deployment nginx --image=nginx
Create a deployment
terminal
$ kubectl get deployments
List all deployments
terminal
$ kubectl scale deployment nginx --replicas=3
Scale to 3 replicas
terminal
$ kubectl delete deployment nginx
Delete deployment

ConfigMaps & Secrets

Externalize configuration and sensitive data from application code for better security and flexibility.

Topics
kubernetesconfig

Code Examples

(4)
terminal
$ kubectl create configmap myconfig --from-literal=ENV=prod
Create config from literal value
terminal
$ kubectl create secret generic mysecret --from-literal=password=secret123
Create secret with password
terminal
$ kubectl get configmaps
List all ConfigMaps
terminal
$ kubectl get secrets
List all Secrets

Services - Networking & Load Balancing

Stable network endpoints for pods with load balancing across replicas using ClusterIP, NodePort, and LoadBalancer types.

Topics
kubernetesservices

Code Examples

(4)
terminal
$ kubectl expose deployment nginx --port=80
Expose deployment as service
terminal
$ kubectl get services
List all services
terminal
$ kubectl describe service nginx
Show service details
terminal
$ kubectl delete service nginx
Delete service

Namespaces & Isolation

Logical partitions for names, RBAC scoping, resource quotas, network policies.

Topics
kubernetesnamespaces

Code Examples

(1)
terminal
$ kubectl get all -n kube-system
View system namespace

Volumes & Persistent Storage

Data persistence through volumes, PersistentVolumes (PV), and PersistentVolumeClaims (PVC) for stateful applications.

Topics
kubernetesstorage

Code Examples

(3)
terminal
$ kubectl get pv,pvc
List persistent volumes and claims
terminal
$ kubectl describe pvc my-pvc
Show PVC details and binding status
terminal
$ kubectl get storageclass
List available storage classes

Probes: Readiness vs Liveness

Readiness gates traffic, liveness restarts unhealthy containers; startupProbe for slow boots.

Topics
kuberneteshealth

Code Examples

(1)
terminal
$ readinessProbe:
  httpGet:
    path: /health
    port: 8080
  initialDelaySeconds: 5
  periodSeconds: 10
Sample readiness probe

StatefulSets - Stateful Applications

Manages stateful applications requiring stable network identities, persistent storage, and ordered deployment/scaling.

Topics
kubernetesstatefulsets

Code Examples

(3)
terminal
$ kubectl get statefulsets
List StatefulSets
terminal
$ kubectl scale statefulset web --replicas=5
Scale StatefulSet to 5 replicas
terminal
$ kubectl get pods -l app=web
List StatefulSet pods

Ingress Basics

HTTP routing layer mapping host/path to Services via ingress controller (nginx, traefik, gateway API evolving).

Topics
kubernetesingress

Code Examples

(1)
terminal
$ kubectl apply -f ingress.yaml
Apply an Ingress resource

Jobs & CronJobs - Batch Workloads

Run batch tasks to completion with Jobs, and schedule recurring tasks with CronJobs using cron syntax.

Topics
kubernetesjobs

Code Examples

(3)
terminal
$ kubectl create job backup --image=backup-tool
Create a one-time job
terminal
$ kubectl get jobs,cronjobs
List jobs and cronjobs
terminal
$ kubectl create cronjob backup --image=backup-tool --schedule='0 2 * * *'
Create daily backup at 2 AM

RBAC Basics

Role/ClusterRole define permissions; (Cluster)RoleBinding attaches them to subjects (users, groups, ServiceAccounts).

Topics
kubernetesrbacsecurity

Code Examples

(1)
terminal
$ kubectl get clusterrolebinding | grep admin
Inspect high-privileged bindings

DaemonSets - Node-Level Services

Ensures a pod runs on all (or selected) nodes, typically for system-level services like monitoring and logging.

Topics
kubernetesdaemonsets

Code Examples

(3)
terminal
$ kubectl get daemonsets -A
List DaemonSets across all namespaces
terminal
$ kubectl describe daemonset fluentd
Show DaemonSet details
terminal
$ kubectl get pods -o wide -l app=monitoring
Show DaemonSet pod distribution

kubectl Commands

Common verbs: get, describe, logs, exec, apply, rollout, top; use -o wide / jsonpath for details.

Topics
kuberneteskubectl

Code Examples

(2)
terminal
$ kubectl logs deploy/api -f
Follow logs of all pods in a deployment
terminal
$ kubectl rollout status deploy/api
Watch rollout progress

Resource Limits & Requests

Control CPU and memory allocation with requests (guaranteed) and limits (maximum) for efficient resource management.

Topics
kubernetesresources

Code Examples

(3)
terminal
$ kubectl top pods --sort-by=cpu
Show pods sorted by CPU usage
terminal
$ kubectl describe pod <pod-name> | grep -A 5 Limits
Check pod resource limits
terminal
$ kubectl get limitrange
View namespace resource constraints

Labels & Selectors

Key/value metadata driving selection (Services, Deployments, NetworkPolicies). Immutable keys, mutable values.

Topics
kuberneteslabels

Code Examples

(1)
terminal
$ kubectl get pods -l app=web
Select pods with label app=web

Horizontal & Vertical Pod Autoscaling

Automatically scale applications based on CPU, memory, or custom metrics with HPA and VPA.

Topics
kubernetesautoscaling

Code Examples

(3)
terminal
$ kubectl autoscale deployment nginx --cpu-percent=50 --min=1 --max=10
Create HPA for deployment
terminal
$ kubectl get hpa
List horizontal pod autoscalers
terminal
$ kubectl describe hpa nginx
Show HPA details and events

Network Policies - Micro-segmentation

Control network traffic between pods using firewall-like rules for enhanced security and isolation.

Topics
kubernetesnetworkingsecurity

Code Examples

(3)
terminal
$ kubectl get networkpolicies -A
List all network policies
terminal
$ kubectl describe networkpolicy deny-all
Show network policy details
terminal
$ kubectl exec -it pod1 -- curl pod2:8080
Test network connectivity

CI/CD

10 concepts β€’ 20 questions

What is CI/CD?

CI/CD (Continuous Integration/Continuous Deployment) is a methodology that automates the software delivery pipeline from code commit to production deployment. CI focuses on automatically building, testing, and integrating code changes, while CD automates the deployment process. This approach reduces manual errors, accelerates release cycles, improves code quality through automated testing, and enables rapid feedback loops for development teams.

Learning Sections

Choose your learning path

What is CI/CD?

Continuous Integration and Continuous Delivery/Deployment practices that automate software development lifecycle from code commit to production.

Topics
cicdintroduction

Code Examples

(2)
terminal
$ git push origin main
Triggers CI pipeline automatically
terminal
$ docker build -t app:latest .
Build deployable container

CI/CD Core Principles

Fundamental practices: frequent integration, automated testing, deployment automation, and fast feedback loops.

Topics
cicdprinciples

Code Examples

(3)
terminal
$ git push origin main
Triggers automated CI pipeline
terminal
$ npm run test:ci
Run tests in CI environment
terminal
$ docker build -t app:${BUILD_NUMBER} .
Build versioned artifact

Common Tools

Jenkins, GitHub Actions, GitLab CI, CircleCI, Argo Workflows, Tekton.

Topics
cicdtools

Code Examples

(1)
terminal
$ github/workflows/ci.yml
GitHub Actions workflow file path

Pipeline Stages

Typical sequence: checkout -> build -> test -> security scan -> package -> artifact publish -> deploy.

Topics
cicdpipeline

Code Examples

(1)
terminal
$ stages: [build, test, deploy]
Simplified stage list in YAML

Triggers

Events starting pipelines: git push, PR, tag, manual approval, schedule (cron), API/webhook.

Topics
cicdtriggers

Code Examples

(1)
terminal
$ on: [push, pull_request]
GitHub Actions trigger syntax

Artifact Management

Store built outputs immutably (containers, packages) with metadata & provenance.

Topics
cicdartifacts

Code Examples

(1)
terminal
$ docker build -t registry/app:1.2.3 .
Build & tag image artifact

Environment Variables & Secrets

Parameterize pipelines with env vars; secure secrets via vaults, masked logs, least privilege.

Topics
cicdsecurity

Code Examples

(1)
terminal
$ echo "${API_URL}"
Referencing injected env var

Branching Strategies

GitFlow (feature/release/hotfix branches) vs Trunk-Based (short-lived branches, feature flags).

Topics
cicdgit

Code Examples

(1)
terminal
$ git checkout -b feature/login
Create short-lived feature branch

Testing in CI/CD

Automated testing pyramid: unit tests, integration tests, end-to-end tests, and quality gates for reliable deployments.

Topics
cicdtesting

Code Examples

(3)
terminal
$ jest --coverage --ci
Run unit tests with coverage in CI
terminal
$ cypress run --record
Execute e2e tests and record results
terminal
$ sonar-scanner -Dsonar.projectKey=myapp
Run code quality analysis

Deployment Strategies

Blue-green, canary, rolling deployments, and feature flags for safe, controlled releases with minimal downtime.

Topics
cicddeployment

Code Examples

(3)
terminal
$ kubectl patch deployment app -p '{"spec":{"template":{"spec":{"containers":[{"name":"app","image":"app:v2"}]}}}'
Rolling update deployment
terminal
$ istioctl kiali dashboard
Monitor canary deployment traffic
terminal
$ kubectl rollout undo deployment/app
Rollback failed deployment

Monitoring

10 concepts β€’ 20 questions

What is Monitoring?

Monitoring in DevOps involves collecting, analyzing, and visualizing system metrics, logs, and application performance data to ensure optimal operation and quick issue resolution. It includes infrastructure monitoring (CPU, memory, disk), application performance monitoring (APM), log aggregation, alerting, and observability practices. Effective monitoring enables proactive issue detection, performance optimization, and data-driven decision making for system reliability.

Learning Sections

Choose your learning path

Introduction to Monitoring

Monitoring is the continuous observation and measurement of system performance, availability, and health to ensure optimal operation and rapid issue detection.

Topics
monitoringintroductiondevops

Code Examples

(2)
terminal
$ curl -s http://localhost:9090/metrics | grep cpu
Query Prometheus metrics for CPU data
terminal
$ docker stats --no-stream
Get current container resource usage

Types of Monitoring

Infrastructure, application, network, and synthetic monitoring layers each provide different perspectives on system health and performance.

Topics
monitoringinfrastructureapplicationnetworksynthetic

Code Examples

(2)
terminal
$ sar -u 1 5
Monitor CPU utilization every second for 5 intervals
terminal
$ curl -w '%{time_total}
' -o /dev/null -s http://api.example.com
Measure API response time

The Three Pillars: Metrics, Logs, Traces

The foundational telemetry data types that provide comprehensive system observability when used together.

Topics
monitoringobservabilitymetricslogstraces

Code Examples

(3)
terminal
$ rate(http_requests_total[5m])
Prometheus query for request rate over 5 minutes
terminal
$ kubectl logs -f deployment/app --tail=100
Follow Kubernetes application logs
terminal
$ trace_id=abc123 span_id=def456 duration=180ms
Distributed trace span with timing

Prometheus - Metrics Collection

Open-source monitoring system with powerful query language, pull-based architecture, and built-in alerting capabilities.

Topics
monitoringprometheusmetricsalerting

Code Examples

(2)
terminal
$ rate(http_requests_total{status=~"5.."}[5m]) > 0.1
PromQL query for high error rate
terminal
$ prometheus --config.file=/etc/prometheus/prometheus.yml
Start Prometheus with custom config

Grafana - Data Visualization

Powerful dashboard and visualization platform supporting multiple data sources with rich graphing capabilities.

Topics
monitoringgrafanavisualizationdashboards

Code Examples

(2)
terminal
$ sum(rate(http_requests_total[5m])) by (service)
Grafana panel query for request rate by service
terminal
$ grafana-cli plugins list-remote
List available Grafana plugins

ELK Stack - Log Management

Elasticsearch, Logstash, and Kibana stack for centralized log collection, processing, storage, and visualization.

Topics
monitoringloggingelasticsearchlogstashkibana

Code Examples

(2)
terminal
$ curl -X GET 'localhost:9200/_search?q=error&size=10'
Search Elasticsearch for error logs
terminal
$ filebeat setup --dashboards
Setup Kibana dashboards for Filebeat

Alerting Strategies & Best Practices

Effective alerting focuses on user-impacting symptoms with actionable, well-tuned notifications to minimize noise and maximize response effectiveness.

Topics
monitoringalertingsloincident-response

Code Examples

(2)
terminal
$ rate(http_requests_total{status=~"5.."}[5m]) / rate(http_requests_total[5m]) > 0.05
Alert on 5% error rate threshold
terminal
$ amtool silence add alertname="HighErrorRate" --duration=2h
Silence alert for 2 hours

Distributed Tracing

End-to-end request tracking across microservices to understand performance bottlenecks and failure propagation in distributed systems.

Topics
monitoringtracingmicroservicesperformance

Code Examples

(2)
terminal
$ curl 'http://localhost:16686/api/traces?service=frontend&limit=10'
Query Jaeger for frontend service traces
terminal
$ otel-collector --config=otel-config.yaml
Start OpenTelemetry collector

SLO/SLI Monitoring

Service Level Objectives and Indicators provide user-focused reliability targets and measurement frameworks for service quality.

Topics
monitoringsloslireliability

Code Examples

(2)
terminal
$ sum(rate(http_requests_total{status!~"5.."}[5m])) / sum(rate(http_requests_total[5m]))
Calculate availability SLI
terminal
$ histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m]))
Calculate 95th percentile latency SLI

Dashboard Design & Visualization

Effective dashboard design follows hierarchy principles, focuses on actionable insights, and provides clear visual communication of system health.

Topics
monitoringdashboardsvisualizationux

Code Examples

(2)
terminal
$ sum by (service) (rate(http_requests_total[5m]))
Dashboard panel showing request rate by service
terminal
$ grafana-cli plugins install grafana-piechart-panel
Install pie chart visualization plugin

Terraform

10 concepts β€’ 20 questions

What is Terraform?

Terraform is an Infrastructure as Code (IaC) tool that enables you to define, provision, and manage cloud infrastructure using declarative configuration files. It supports multiple cloud providers and services, allowing you to version control your infrastructure, ensure consistency across environments, and automate resource provisioning. Terraform's state management and planning capabilities provide predictable infrastructure changes and drift detection.

Learning Sections

Choose your learning path

Introduction to Terraform

Terraform is an open-source Infrastructure as Code (IaC) tool that enables you to define, provision, and manage cloud infrastructure using declarative configuration files.

Topics
terraformintroductioniac

Code Examples

(2)
terminal
$ terraform --version
Check Terraform version
terminal
$ terraform init
Initialize Terraform working directory

Infrastructure as Code Principles

IaC principles emphasize declarative configuration, version control, reproducibility, and treating infrastructure like application code.

Topics
terraformiacprinciples

Code Examples

(2)
terminal
$ resource "aws_s3_bucket" "logs" {
  bucket = var.bucket_name
  tags = var.common_tags
}
Declarative S3 bucket with variables
terminal
$ terraform fmt -recursive
Format all Terraform files recursively

Terraform Core Workflow

The standard Terraform workflow follows init β†’ validate β†’ plan β†’ apply β†’ destroy pattern for safe infrastructure management.

Topics
terraformworkflowcommands

Code Examples

(2)
terminal
$ terraform init
terraform validate
terraform plan -out=plan.tfplan
terraform apply plan.tfplan
Complete workflow with saved plan
terminal
$ terraform plan -var='environment=prod' -var-file='prod.tfvars'
Plan with variables and variable file

Terraform Providers

Providers are plugins that enable Terraform to interact with cloud platforms, SaaS providers, and other APIs through resource and data source implementations.

Topics
terraformprovidersplugins

Code Examples

(2)
terminal
$ terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}
Provider version constraint
terminal
$ terraform providers lock -platform=linux_amd64 -platform=darwin_amd64
Generate provider locks for multiple platforms

Terraform Modules

Modules are reusable, self-contained packages of Terraform configurations that encapsulate infrastructure patterns and promote code reuse.

Topics
terraformmodulesreusability

Code Examples

(2)
terminal
$ module "vpc" {
  source = "terraform-aws-modules/vpc/aws"
  version = "~> 5.0"
  
  name = var.vpc_name
  cidr = var.vpc_cidr
}
Using a registry module with variables
terminal
$ output "vpc_id" {
  value = module.vpc.vpc_id
}
Referencing module outputs

State Management

Terraform state tracks resource mappings and metadata, enabling infrastructure lifecycle management and team collaboration through remote backends.

Topics
terraformstatecollaboration

Code Examples

(2)
terminal
$ terraform {
  backend "s3" {
    bucket = "my-terraform-state"
    key = "prod/terraform.tfstate"
    region = "us-west-2"
    dynamodb_table = "terraform-locks"
    encrypt = true
  }
}
S3 backend with DynamoDB locking
terminal
$ terraform state mv aws_instance.web aws_instance.web_server
Rename resource in state

Variables & Outputs

Variables provide input parameters for flexible configurations, while outputs expose computed values for consumption by other configurations or external systems.

Topics
terraformvariablesoutputs

Code Examples

(2)
terminal
$ variable "environment" {
  type = string
  description = "Environment name"
  validation {
    condition = contains(["dev", "staging", "prod"], var.environment)
    error_message = "Environment must be dev, staging, or prod."
  }
}
Variable with validation
terminal
$ output "load_balancer_dns" {
  value = aws_lb.main.dns_name
  description = "DNS name of the load balancer"
}
Output with description

Terraform Workspaces

Workspaces enable managing multiple environments or configurations with the same Terraform code using separate state files.

Topics
terraformworkspacesenvironments

Code Examples

(2)
terminal
$ resource "aws_instance" "web" {
  tags = {
    Name = "web-${terraform.workspace}"
    Environment = terraform.workspace
  }
}
Workspace-aware resource naming
terminal
$ terraform workspace new staging && terraform workspace select staging
Create and switch to staging workspace

Data Sources

Data sources allow Terraform to fetch information about existing infrastructure and external systems without managing them.

Topics
terraformdata-sourcesinformation

Code Examples

(2)
terminal
$ data "aws_ami" "ubuntu" {
  most_recent = true
  owners = ["099720109477"]
  filter {
    name = "name"
    values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
  }
}
Find latest Ubuntu AMI
terminal
$ data "aws_availability_zones" "available" {
  state = "available"
}
Get available AZs in current region

Terraform Registry

The Terraform Registry is a public repository hosting thousands of providers and modules for infrastructure automation and reuse.

Topics
terraformregistrymodulesproviders

Code Examples

(2)
terminal
$ module "vpc" {
  source = "terraform-aws-modules/vpc/aws"
  version = "~> 5.0"
  
  name = "my-vpc"
  cidr = "10.0.0.0/16"
}
Using registry module with semantic versioning
terminal
$ terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}
Registry provider specification

Jenkins

10 concepts β€’ 20 questions

What is Jenkins?

Jenkins is an open-source automation server that facilitates Continuous Integration and Continuous Deployment (CI/CD) pipelines. It automates the building, testing, and deployment of applications through configurable workflows called pipelines. Jenkins supports extensive plugin ecosystem, distributed builds, and integration with various tools and platforms. It enables teams to automate repetitive tasks, ensure code quality, and accelerate software delivery processes.

Learning Sections

Choose your learning path

Introduction to Jenkins

Jenkins is an open-source automation server that enables Continuous Integration and Continuous Delivery through automated build, test, and deployment pipelines.

Topics
jenkinsintroductionci-cd

Code Examples

(2)
terminal
$ java -jar jenkins.war --httpPort=8080
Start Jenkins on port 8080
terminal
$ curl -X GET http://localhost:8080/api/json
Query Jenkins API for system information

Jenkins Architecture

Master-agent architecture with controller orchestrating builds and agents executing workloads in distributed, scalable environments.

Topics
jenkinsarchitecturescalability

Code Examples

(2)
terminal
$ agent {
  kubernetes {
    yaml '''
      apiVersion: v1
      kind: Pod
      spec:
        containers:
        - name: maven
          image: maven:3.8.1-jdk-11
    '''
  }
}
Kubernetes pod agent definition
terminal
$ agent { label 'linux && docker' }
Agent selection with multiple labels

Pipeline Types & Job Categories

Jenkins supports multiple job types from simple Freestyle projects to sophisticated Pipeline-as-Code implementations for different automation needs.

Topics
jenkinspipelinejob-types

Code Examples

(2)
terminal
$ pipeline {
  agent any
  stages {
    stage('Build') {
      steps {
        sh 'npm ci'
        sh 'npm run build'
      }
    }
  }
}
Basic declarative pipeline with build stage
terminal
$ node {
  stage('Checkout') {
    checkout scm
  }
  stage('Build') {
    sh 'make build'
  }
}
Scripted pipeline example

Jenkinsfile Syntax & Structure

Jenkinsfiles define Pipeline-as-Code using Declarative (structured) or Scripted (Groovy-based) syntax for version-controlled build automation.

Topics
jenkinsjenkinsfilepipeline-as-code

Code Examples

(2)
terminal
$ pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        sh 'go test ./...'
      }
    }
  }
  post {
    always {
      junit 'test-results.xml'
    }
  }
}
Declarative pipeline with post actions
terminal
$ @Library('shared-library') _

pipeline {
  agent any
  stages {
    stage('Deploy') {
      steps {
        deployToEnvironment('staging')
      }
    }
  }
}
Using shared library in declarative pipeline

Pipeline Stages & Steps

Stages organize pipeline phases logically while steps execute specific actions, supporting parallel execution and conditional logic.

Topics
jenkinsstagesstepsparallel

Code Examples

(2)
terminal
$ stages {
  stage('Build') {
    steps {
      sh 'mvn clean compile'
    }
  }
  stage('Test') {
    parallel {
      stage('Unit Tests') {
        steps {
          sh 'mvn test'
        }
      }
      stage('Integration Tests') {
        steps {
          sh 'mvn integration-test'
        }
      }
    }
  }
}
Stages with parallel execution
terminal
$ stage('Deploy') {
  when {
    branch 'main'
  }
  steps {
    sh 'kubectl apply -f deployment.yaml'
  }
}
Conditional stage execution

Plugin Ecosystem & Management

Jenkins' extensive plugin ecosystem extends functionality for SCM, build tools, notifications, cloud platforms, and integrations while requiring careful management.

Topics
jenkinspluginsmanagement

Code Examples

(2)
terminal
$ # plugins.txt
git:latest
pipeline-stage-view:latest
blue-ocean:latest
docker-plugin:latest
kubernetes:latest
Plugin installation specification file
terminal
$ jenkins-plugin-cli --plugin-file plugins.txt --plugin-download-directory /var/jenkins_home/plugins
Install plugins from specification file

Build Triggers & Automation

Multiple trigger mechanisms enable automated builds through SCM changes, schedules, dependencies, and external events for comprehensive CI/CD automation.

Topics
jenkinstriggersautomation

Code Examples

(2)
terminal
$ triggers {
  pollSCM('H/15 * * * *')
  cron('@daily')
  upstream(upstreamProjects: 'upstream-job', threshold: hudson.model.Result.SUCCESS)
}
Multiple trigger types in declarative pipeline
terminal
$ curl -X POST -H 'Authorization: Bearer TOKEN' http://jenkins/job/my-job/build
API trigger with authentication

Credentials & Security Management

Centralized, encrypted credential storage with role-based access control, supporting multiple secret types and secure injection into build processes.

Topics
jenkinssecuritycredentials

Code Examples

(2)
terminal
$ withCredentials([
  usernamePassword(credentialsId: 'docker-hub', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS'),
  string(credentialsId: 'api-token', variable: 'API_TOKEN')
]) {
  sh 'docker login -u $DOCKER_USER -p $DOCKER_PASS'
  sh 'curl -H "Authorization: Bearer $API_TOKEN" api.example.com'
}
Multiple credential types in pipeline
terminal
$ environment {
  VAULT_ADDR = 'https://vault.company.com'
  VAULT_NAMESPACE = 'jenkins'
}
Vault integration configuration

Workspace & Artifact Management

Efficient workspace and artifact management ensures clean builds, proper storage, and reliable artifact distribution across pipeline stages.

Topics
jenkinsworkspaceartifacts

Code Examples

(2)
terminal
$ pipeline {
  agent any
  stages {
    stage('Build') {
      steps {
        sh 'make build'
        archiveArtifacts artifacts: 'dist/**/*.jar', fingerprint: true
        publishHTML([
          allowMissing: false,
          alwaysLinkToLastBuild: true,
          keepAll: true,
          reportDir: 'reports',
          reportFiles: 'index.html',
          reportName: 'Build Report'
        ])
      }
    }
  }
  post {
    always {
      cleanWs()
    }
  }
}
Complete artifact and workspace management
terminal
$ stash includes: 'target/**/*.jar', name: 'build-artifacts'
// Later stage
unstash 'build-artifacts'
Stash and unstash for inter-stage file transfer

Distributed Builds & Scaling

Horizontal scaling through agent management, load balancing, and cloud-native architectures for high-throughput CI/CD operations.

Topics
jenkinsscalingdistributedagents

Code Examples

(2)
terminal
$ pipeline {
  agent {
    kubernetes {
      yaml '''
        apiVersion: v1
        kind: Pod
        spec:
          containers:
          - name: maven
            image: maven:3.8.1-jdk-11
            command:
            - sleep
            args:
            - 99d
      '''
    }
  }
  stages {
    stage('Build') {
      steps {
        container('maven') {
          sh 'mvn clean package'
        }
      }
    }
  }
}
Kubernetes pod agent with custom container
terminal
$ agent {
  label 'linux && docker && high-memory'
}
Agent selection with multiple requirements

Git / GitHub

12 concepts β€’ 20 questions

What is Git / GitHub?

Git is a distributed version control system that tracks changes in source code during software development. It enables multiple developers to collaborate efficiently, maintains complete project history, and supports branching and merging workflows. Git provides features like commit tracking, branch management, conflict resolution, and remote repository synchronization. Understanding Git is essential for modern software development and DevOps practices.

Learning Sections

Choose your learning path

Introduction to Git & GitHub

Git is a distributed version control system, while GitHub is a cloud-based platform that hosts Git repositories and provides collaboration features.

Topics
gitgithubintroduction

Code Examples

(2)
terminal
$ git --version
Check Git installation and version
terminal
$ git clone https://github.com/user/repo.git
Clone a repository from GitHub

Version Control Fundamentals

Understanding repositories, working directory, staging area, and the three-tree architecture that makes Git powerful.

Topics
gitvcsfundamentals

Code Examples

(2)
terminal
$ git status --porcelain
Machine-readable status output
terminal
$ git log --oneline --graph --all
Visual commit history

Essential Git Commands

Master the fundamental Git commands for daily development workflow: initialization, staging, committing, and synchronization.

Topics
gitcommandsworkflow

Code Examples

(2)
terminal
$ git init
git add README.md
git commit -m 'Initial commit'
git remote add origin https://github.com/user/repo.git
git push -u origin main
Complete repository setup workflow
terminal
$ git add -p
Interactive staging for partial file changes

Branching & Branch Management

Git branches enable parallel development through lightweight, movable pointers that allow safe experimentation and feature isolation.

Topics
gitbranchingworkflow

Code Examples

(2)
terminal
$ git checkout -b feature/user-auth
git push -u origin feature/user-auth
Create feature branch and set upstream
terminal
$ git branch --merged | grep -v main | xargs git branch -d
Clean up merged branches

Merging & Integration Strategies

Different merge strategies (merge commits, fast-forward, squash) provide various approaches to integrating branch changes.

Topics
gitmergingconflicts

Code Examples

(2)
terminal
$ git merge feature/api
# If conflicts occur:
git status
# Edit conflicted files
git add .
git commit
Complete merge workflow with conflict resolution
terminal
$ git rebase -i HEAD~3
Interactive rebase to squash last 3 commits

Remote Repository Operations

Managing connections to remote repositories through fetch, push, pull operations and understanding remote tracking branches.

Topics
gitremotecollaboration

Code Examples

(2)
terminal
$ git remote add upstream https://github.com/original/repo.git
git fetch upstream
git merge upstream/main
Sync fork with upstream repository
terminal
$ git push --force-with-lease origin feature-branch
Safe force push that checks for remote changes

GitHub Collaboration Features

GitHub extends Git with collaboration tools: forks, pull requests, issues, and GitHub Actions for comprehensive project management.

Topics
gitgithubcollaboration

Code Examples

(2)
terminal
$ # .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: npm test
Basic GitHub Actions workflow
terminal
$ gh pr create --title 'Add new feature' --body 'Description of changes'
Create pull request via GitHub CLI

Git Stash & Temporary Storage

Git stash provides temporary storage for work-in-progress changes, enabling clean branch switching and emergency fixes.

Topics
gitstashworkflow

Code Examples

(2)
terminal
$ git stash push -m 'WIP: user authentication feature'
git checkout hotfix-branch
# Make hotfix
git checkout feature-branch
git stash pop
Stash workflow for emergency fixes
terminal
$ git stash show -p stash@{1}
View specific stash contents

.gitignore & File Management

Controlling which files Git tracks through .gitignore patterns, global ignores, and file management best practices.

Topics
gitgitignorefile-management

Code Examples

(2)
terminal
$ # .gitignore
# Dependencies
node_modules/
*.log

# Build outputs
dist/
build/

# Environment
.env
.env.local

# IDE
.vscode/
*.swp
Comprehensive .gitignore example
terminal
$ git config --global core.excludesfile ~/.gitignore_global
Set global gitignore file

Tagging & Release Management

Git tags mark specific commits for releases, milestones, and important points in project history with lightweight or annotated formats.

Topics
gittagsreleases

Code Examples

(2)
terminal
$ git tag -a v1.2.0 -m 'Release 1.2.0: Added user authentication'
git push origin v1.2.0
Create and push annotated release tag
terminal
$ git describe --tags --abbrev=0
Get latest tag name

Advanced Git Operations

Advanced Git features including interactive rebase, cherry-pick, reflog, and repository maintenance for complex workflows.

Topics
gitadvancedmaintenance

Code Examples

(2)
terminal
$ git rebase -i HEAD~3
# In editor: change 'pick' to 'squash' for commits to combine
# Save and edit commit message
Squash last 3 commits into one
terminal
$ git bisect start
git bisect bad HEAD
git bisect good v1.0.0
# Test each commit Git presents
git bisect good/bad
git bisect reset
Binary search for bug introduction

Git Configuration & Customization

Comprehensive Git configuration including user identity, aliases, hooks, and environment-specific settings for optimal workflow.

Topics
gitconfigcustomization

Code Examples

(2)
terminal
$ # ~/.gitconfig
[user]
    name = John Doe
    email = john@example.com
[alias]
    st = status -sb
    co = checkout
    br = branch
    unstage = reset HEAD --
[includeIf "gitdir:~/work/"]
    path = ~/.gitconfig-work
Comprehensive Git configuration example
terminal
$ git config --global core.hooksPath ~/.githooks
Set global hooks directory

GitOps

10 concepts β€’ 20 questions

What is GitOps?

GitOps is a operational framework that uses Git repositories as the single source of truth for declarative infrastructure and application configuration. It applies Git workflows to operations, enabling automated deployments, rollbacks, and infrastructure management through pull requests and Git commits. GitOps promotes transparency, auditability, and consistency by treating infrastructure and application configurations as code, with Git serving as the control plane.

Learning Sections

Choose your learning path

Introduction to GitOps

GitOps is an operational framework that uses Git repositories as the single source of truth for declarative infrastructure and application configuration.

Topics
gitopsintroductionconcept

Code Examples

(2)
terminal
$ git clone https://github.com/company/k8s-configs.git
cd k8s-configs
kubectl apply -f apps/production/
Basic GitOps workflow
terminal
$ # .github/workflows/validate.yml
name: Validate Manifests
on: [push, pull_request]
jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: kubectl apply --dry-run=client -f manifests/
CI validation of GitOps manifests

GitOps Core Principles

Four fundamental principles: declarative configuration, version control as source of truth, automated deployment, and continuous reconciliation.

Topics
gitopsprinciplesfundamentals

Code Examples

(2)
terminal
$ # Declarative Kubernetes manifest
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web-app
  template:
    metadata:
      labels:
        app: web-app
    spec:
      containers:
      - name: web
        image: nginx:1.21
Declarative application configuration
terminal
$ git log --oneline --graph
git show <commit-hash>
git revert <commit-hash>
Version control operations for GitOps

Core Principles

Declarative, versioned, automated sync, continuous reconciliation.

Topics
gitopsprinciples

Code Examples

(1)
terminal
$ kubectl apply -f manifests/ (performed by controller)
Automated application of desired state

Argo CD - GitOps for Kubernetes

Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes with a rich UI and multi-cluster support.

Topics
gitopsargocdkubernetes

Code Examples

(2)
terminal
$ apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: web-app
  namespace: argocd
spec:
  project: default
  source:
    repoURL: https://github.com/company/k8s-configs
    targetRevision: HEAD
    path: apps/web-app
  destination:
    server: https://kubernetes.default.svc
    namespace: production
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
Complete Argo CD Application manifest
terminal
$ argocd app create web-app \
  --repo https://github.com/company/k8s-configs \
  --path apps/web-app \
  --dest-server https://kubernetes.default.svc \
  --dest-namespace production
Create Argo CD application via CLI

Flux CD - GitOps Toolkit

Flux is a modular GitOps toolkit providing source, kustomize, helm, and notification controllers for Kubernetes.

Topics
gitopsfluxkubernetes

Code Examples

(2)
terminal
$ flux create source git webapp \
  --url=https://github.com/company/k8s-configs \
  --branch=main \
  --interval=1m

flux create kustomization webapp \
  --target-namespace=production \
  --source=webapp \
  --path="./apps/webapp" \
  --prune=true \
  --interval=5m
Create Flux GitOps workflow
terminal
$ apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: nginx
  namespace: default
spec:
  interval: 5m
  chart:
    spec:
      chart: nginx
      version: '1.x'
      sourceRef:
        kind: HelmRepository
        name: bitnami
  values:
    replicaCount: 3
Flux HelmRelease configuration

Pull-based vs Push-based Deployments

GitOps favors pull-based architecture where cluster agents pull configurations from Git, improving security and reliability over push-based CI/CD.

Topics
gitopssecurityarchitecture

Code Examples

(2)
terminal
$ # Pull-based reconciliation loop
while true; do
  git fetch origin main
  kubectl diff -f manifests/
  kubectl apply -f manifests/
  kubectl get events --sort-by='.lastTimestamp'
  sleep 30
done
Simplified pull-based reconciliation logic
terminal
$ # Push-based deployment (traditional)
# In CI/CD pipeline:
kubectl config use-context production
kubectl apply -f manifests/

# vs Pull-based (GitOps)
# Agent in cluster:
flux reconcile kustomization webapp --with-source
Comparison of push vs pull deployment models

GitOps Repository Structure

Organizing Git repositories for GitOps with proper separation of concerns, environment management, and application configurations.

Topics
gitopsrepositorystructure

Code Examples

(2)
terminal
$ # GitOps Repository Structure
k8s-configs/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ web-app/
β”‚   β”‚   β”œβ”€β”€ base/
β”‚   β”‚   β”‚   β”œβ”€β”€ deployment.yaml
β”‚   β”‚   β”‚   β”œβ”€β”€ service.yaml
β”‚   β”‚   β”‚   └── kustomization.yaml
β”‚   β”‚   └── overlays/
β”‚   β”‚       β”œβ”€β”€ dev/
β”‚   β”‚       β”œβ”€β”€ staging/
β”‚   β”‚       └── production/
β”‚   └── api-service/
β”œβ”€β”€ infrastructure/
β”‚   β”œβ”€β”€ namespaces/
β”‚   β”œβ”€β”€ rbac/
β”‚   └── monitoring/
└── clusters/
    β”œβ”€β”€ dev-cluster/
    β”œβ”€β”€ staging-cluster/
    └── prod-cluster/
Typical GitOps repository structure
terminal
$ # Kustomization overlay example
# overlays/production/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
replicas:
- name: web-app
  count: 5
images:
- name: web-app
  newTag: v1.2.3
Environment-specific configuration overlay

Secrets Management in GitOps

Handling sensitive data in GitOps workflows through external secret managers, sealed secrets, and encryption strategies.

Topics
gitopssecretssecurity

Code Examples

(2)
terminal
$ # Sealed Secret example
apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
  name: db-credentials
  namespace: production
spec:
  encryptedData:
    username: AgBy3i4OJSWK+PiTySYZZA9rO43cGDEQAx...
    password: AgBy3i4OJSWK+PiTySYZZA9rO43cGDEQAx...
Sealed Secret for safe Git storage
terminal
$ # External Secrets Operator
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: vault-secret
spec:
  refreshInterval: 15s
  secretStoreRef:
    name: vault-backend
    kind: SecretStore
  target:
    name: db-credentials
  data:
  - secretKey: username
    remoteRef:
      key: database
      property: username
External Secret syncing from Vault

Multi-Environment GitOps

Managing multiple environments (dev/staging/prod) in GitOps through branching strategies, directory structures, and promotion workflows.

Topics
gitopsenvironmentspromotion

Code Examples

(2)
terminal
$ # Branch-per-environment workflow
git checkout dev
git add .
git commit -m 'Add new feature'
git push origin dev

# Promote to staging
git checkout staging
git merge dev
git push origin staging

# Promote to production
git checkout main
git merge staging
git push origin main
Environment promotion through Git branches
terminal
$ # Directory-per-environment with Kustomize
envs/
β”œβ”€β”€ base/
β”‚   β”œβ”€β”€ deployment.yaml
β”‚   └── kustomization.yaml
β”œβ”€β”€ dev/
β”‚   β”œβ”€β”€ kustomization.yaml
β”‚   └── replica-patch.yaml
β”œβ”€β”€ staging/
β”‚   β”œβ”€β”€ kustomization.yaml
β”‚   └── resource-patch.yaml
└── production/
    β”œβ”€β”€ kustomization.yaml
    └── production-patch.yaml
Environment-specific configurations with Kustomize

GitOps Benefits & Challenges

Understanding the advantages of GitOps (auditability, rollbacks, security) and common challenges (secrets, complexity, tooling).

Topics
gitopsbenefitschallenges

Code Examples

(2)
terminal
$ # Audit trail example
git log --oneline --graph --all
* 2f8a9c1 (HEAD -> main) Update production replicas to 5
* 1a7b3d2 Add health check endpoint
* 9e4f6c8 Initial application deployment

# Rollback example
git revert 2f8a9c1
# This creates a new commit that undoes the replica change
GitOps audit trail and rollback capabilities
terminal
$ # Measuring GitOps success
# Deployment frequency
git log --since='1 month ago' --oneline | wc -l

# Lead time (commit to deployment)
kubectl get applications -o json | jq '.items[] | {name: .metadata.name, lastSync: .status.operationState.finishedAt}'

# Change failure rate
kubectl get events --field-selector reason=Failed
Metrics for measuring GitOps effectiveness

GitHub Actions

11 concepts β€’ 20 questions

What is GitHub Actions?

GitHub Actions is a CI/CD platform integrated directly into GitHub repositories that automates software workflows. It enables you to build, test, and deploy code directly from GitHub using customizable workflows triggered by repository events. GitHub Actions supports matrix builds, parallel jobs, marketplace actions, and seamless integration with GitHub's ecosystem. It simplifies DevOps automation by providing native CI/CD capabilities within the development platform.

Learning Sections

Choose your learning path

Workflow Structure & Architecture

Hierarchical structure: Workflows contain jobs, jobs contain steps, steps execute actions or commands.

Topics
github_actionsstructurearchitecture

Code Examples

(2)
terminal
$ name: CI Pipeline
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm test
  deploy:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - run: npm run deploy
Complete workflow with job dependency
terminal
$ jobs:
  build:
    outputs:
      version: ${{ steps.version.outputs.value }}
    steps:
      - id: version
        run: echo "value=1.0.0" >> $GITHUB_OUTPUT
Job output sharing between jobs

Workflow Files & Organization

YAML files in .github/workflows/ directory define automated processes with specific naming and organization patterns.

Topics
github_actionsfilesorganization

Code Examples

(2)
terminal
$ .github/workflows/
β”œβ”€β”€ ci.yml          # Continuous Integration
β”œβ”€β”€ deploy.yml       # Deployment
β”œβ”€β”€ release.yml      # Release Management
└── security.yml     # Security Scanning
Organized workflow structure
terminal
$ name: "CI Pipeline"
on: [push, pull_request]
# Workflow content here
Workflow file header with name and triggers

Triggers & Event Types

Comprehensive event system including repository events, scheduled triggers, manual dispatch, and external webhooks.

Topics
github_actionseventstriggers

Code Examples

(2)
terminal
$ on:
  push:
    branches: [main, develop]
    paths: ['src/**', '!docs/**']
  pull_request:
    types: [opened, synchronize]
  schedule:
    - cron: '0 2 * * 1-5'
  workflow_dispatch:
    inputs:
      environment:
        description: 'Environment to deploy'
        required: true
        default: 'staging'
Comprehensive trigger configuration
terminal
$ on:
  release:
    types: [published]
  repository_dispatch:
    types: [deploy-prod]
Release and external API triggers

Runners & Execution Environment

Execution environments including GitHub-hosted runners, self-hosted runners, and container-based execution.

Topics
github_actionsrunnersinfrastructure

Code Examples

(2)
terminal
$ jobs:
  test:
    runs-on: ubuntu-latest
  build:
    runs-on: [self-hosted, linux, large]
  deploy:
    runs-on: ubuntu-latest
    container:
      image: node:18
      options: --cpus 2
Mixed runner types with container
terminal
$ runs-on: ${{ matrix.os }}
strategy:
  matrix:
    os: [ubuntu-latest, windows-latest, macos-latest]
Matrix strategy across different OS runners

Actions & Marketplace

Pre-built, reusable actions from GitHub Marketplace and custom actions for workflow automation.

Topics
github_actionsmarketplacereusability

Code Examples

(2)
terminal
$ steps:
  - uses: actions/checkout@v4
  - uses: actions/setup-node@v4
    with:
      node-version: '18'
      cache: 'npm'
  - uses: actions/upload-artifact@v4
    with:
      name: build-files
      path: dist/
Common marketplace actions usage
terminal
$ uses: ./.github/actions/custom-deploy
with:
  environment: production
  api-key: ${{ secrets.API_KEY }}
Custom local action usage

Environment Variables & Secrets Management

Secure configuration management through environment variables, encrypted secrets, and environment protection rules.

Topics
github_actionssecretssecurity

Code Examples

(2)
terminal
$ env:
  NODE_ENV: production
  API_URL: https://api.example.com
jobs:
  deploy:
    environment: production
    steps:
      - run: |
          echo "Deploying to $NODE_ENV"
          curl -H "Authorization: Bearer ${{ secrets.API_TOKEN }}" $API_URL
Environment variables with secrets
terminal
$ permissions:
  contents: read
  issues: write
  pull-requests: write
GITHUB_TOKEN permission configuration

Artifacts & Caching Strategies

Performance optimization through intelligent caching and artifact management for faster builds and data sharing.

Topics
github_actionsperformanceoptimization

Code Examples

(2)
terminal
$ - name: Cache dependencies
  uses: actions/cache@v4
  with:
    path: |
      ~/.npm
      ~/.cache/pip
      target/
    key: ${{ runner.os }}-deps-${{ hashFiles('**/package-lock.json', '**/requirements.txt', '**/Cargo.lock') }}
    restore-keys: |
      ${{ runner.os }}-deps-
      ${{ runner.os }}-
Multi-language dependency caching
terminal
$ - uses: actions/upload-artifact@v4
  with:
    name: build-${{ github.sha }}
    path: |
      dist/
      coverage/
    retention-days: 30
Artifact upload with retention

Security & Best Practices

Security hardening, supply chain protection, and workflow best practices for safe automation.

Topics
github_actionssecuritybest-practices

Code Examples

(2)
terminal
$ permissions:
  contents: read
  issues: write
  pull-requests: write
  id-token: write  # for OIDC
steps:
  - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
  - name: Configure AWS
    uses: aws-actions/configure-aws-credentials@v4
    with:
      role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
      aws-region: us-east-1
Secure workflow with OIDC and pinned actions
terminal
$ - name: Validate input
  env:
    USER_INPUT: ${{ github.event.inputs.message }}
  run: |
    # Safe: using environment variable
    echo "Processing: $USER_INPUT"
Safe input handling to prevent injection

Matrix Builds & Parallel Execution

Parallel job execution across multiple configurations using matrix strategies for comprehensive testing.

Topics
github_actionsmatrixparallel

Code Examples

(2)
terminal
$ strategy:
  fail-fast: false
  matrix:
    os: [ubuntu-latest, windows-latest, macos-latest]
    node: [18, 20]
    include:
      - os: ubuntu-latest
        node: 16
        experimental: true
    exclude:
      - os: macos-latest
        node: 18
Complex matrix with include/exclude
terminal
$ runs-on: ${{ matrix.os }}
steps:
  - run: echo "Testing on ${{ matrix.os }} with Node ${{ matrix.node }}"
Matrix variable usage in job

Conditional Execution & Expressions

Dynamic workflow control using conditional expressions, contexts, and functions for intelligent automation.

Topics
github_actionsconditionalexpressions

Code Examples

(2)
terminal
$ jobs:
  deploy:
    if: github.ref == 'refs/heads/main' && github.event_name == 'push'
    steps:
      - name: Deploy to production
        if: success()
        run: echo "Deploying..."
      - name: Cleanup on failure
        if: failure()
        run: echo "Cleaning up..."
Job and step-level conditions
terminal
$ if: |
  contains(github.event.head_commit.message, '[skip ci]') == false &&
  (startsWith(github.ref, 'refs/heads/feature/') || github.ref == 'refs/heads/develop')
Complex multi-line condition

Reusable Workflows & Composite Actions

Workflow reusability through callable workflows and composite actions for DRY principles and standardization.

Topics
github_actionsreusabilitystandardization

Code Examples

(2)
terminal
$ # .github/workflows/reusable-deploy.yml
on:
  workflow_call:
    inputs:
      environment:
        required: true
        type: string
    secrets:
      api-key:
        required: true
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Deploying to ${{ inputs.environment }}"
Reusable workflow definition
terminal
$ jobs:
  production:
    uses: ./.github/workflows/reusable-deploy.yml
    with:
      environment: production
    secrets:
      api-key: ${{ secrets.PROD_API_KEY }}
Calling reusable workflow