DevOps là gì? Hướng dẫn toàn diện cho người mới

Tìm hiểu về DevOps: định nghĩa, nguyên tắc cốt lõi, văn hóa, lifecycle và lợi ích. Bước đầu tiên để trở thành Cloud DevOps Engineer.

DevOps là gì?

DevOps là sự kết hợp của Development (Phát triển) và Operations (Vận hành). Đây không chỉ là một công cụ hay công nghệ, mà là một văn hóa, triết lý giúp các team phát triển phần mềm và vận hành hệ thống làm việc cùng nhau hiệu quả hơn.

Tại sao DevOps ra đời?

Trước DevOps, Development và Operations thường hoạt động riêng biệt:

TraditionalDevOps
Dev viết code, “ném” cho OpsDev và Ops cùng làm việc
Blame game khi có lỗiShared responsibility
Deploy mỗi tháng/quýDeploy hàng ngày
Manual processesAutomation mọi thứ

💡 DevOps giải quyết vấn đề: “Nó hoạt động trên máy tôi!” - câu nói kinh điển khi Dev và Ops không sync với nhau.


DevOps Lifecycle (Vòng đời DevOps)

DevOps là một quy trình liên tục, không có điểm kết thúc:

┌─────────────────────────────────────────────────────────┐
│                    DEVOPS LIFECYCLE                     │
├─────────────────────────────────────────────────────────┤
│                                                         │
│    ┌──────┐   ┌──────┐   ┌───────┐   ┌────────┐        │
│    │ PLAN │ → │ CODE │ → │ BUILD │ → │  TEST  │        │
│    └──────┘   └──────┘   └───────┘   └────────┘        │
│        ↑                                    ↓           │
│        │         CONTINUOUS                 │           │
│        │       INTEGRATION                  │           │
│        │                                    ↓           │
│    ┌──────────┐   ┌─────────┐   ┌────────────┐         │
│    │ MONITOR  │ ← │ OPERATE │ ← │  DEPLOY    │         │
│    └──────────┘   └─────────┘   └────────────┘         │
│                                                         │
│              CONTINUOUS DELIVERY                        │
└─────────────────────────────────────────────────────────┘

8 Phases của DevOps

  1. Plan - Lập kế hoạch features, tasks
  2. Code - Viết code, version control (Git)
  3. Build - Compile, tạo artifacts
  4. Test - Unit tests, integration tests
  5. Release - Prepare cho deployment
  6. Deploy - Triển khai lên production
  7. Operate - Vận hành hệ thống
  8. Monitor - Theo dõi performance, logs

Nguyên tắc cốt lõi của DevOps

1. CALMS Framework

Nguyên tắcMô tả
CultureVăn hóa hợp tác, không đổ lỗi
AutomationTự động hóa mọi thứ có thể
LeanLoại bỏ lãng phí, cải tiến liên tục
MeasurementĐo lường mọi thứ
SharingChia sẻ kiến thức, công cụ

2. Three Ways

┌─────────────────────────────────────────────────┐
│ First Way:  FLOW          Dev → Ops             │
│ Second Way: FEEDBACK      Dev ← Ops             │
│ Third Way:  CONTINUOUS LEARNING                 │
└─────────────────────────────────────────────────┘

CI/CD - Trái tim của DevOps

Continuous Integration (CI)

Developers merge code thường xuyên (nhiều lần/ngày) và tự động build + test:

# Ví dụ CI workflow
1. Developer push code lên Git
2. CI server (Jenkins/GitHub Actions) tự động:
   - Pull code
   - Build project
   - Run tests
   - Thông báo kết quả

Continuous Delivery/Deployment (CD)

  • Continuous Delivery: Code luôn sẵn sàng để deploy (manual approval)
  • Continuous Deployment: Tự động deploy lên production

DevOps Tools Landscape

Version Control

  • Git - Essential, không có thay thế
  • GitHub/GitLab/Bitbucket - Hosting và collaboration

CI/CD

  • GitHub Actions - Tích hợp sẵn với GitHub
  • Jenkins - Open source, linh hoạt
  • GitLab CI - Tích hợp trong GitLab

Containerization

  • Docker - Container runtime phổ biến nhất
  • Podman - Alternative không cần daemon

Container Orchestration

  • Kubernetes - Container orchestration tiêu chuẩn
  • AWS ECS/EKS - Managed container services

Infrastructure as Code

  • Terraform - Multi-cloud IaC
  • AWS CloudFormation - AWS native IaC
  • Pulumi - IaC với programming languages

Configuration Management

  • Ansible - Agentless, dễ học
  • Chef/Puppet - Enterprise solutions

Monitoring & Logging

  • Prometheus + Grafana - Metrics và visualization
  • AWS CloudWatch - AWS native monitoring
  • ELK Stack - Logging solution

Cloud DevOps - Tương lai của DevOps

Cloud DevOps kết hợp DevOps practices với Cloud Computing:

Lợi ích của Cloud DevOps

BenefitDescription
ScalabilityScale up/down theo nhu cầu
Cost EfficiencyPay-as-you-go
Global ReachDeploy worldwide
Managed ServicesÍt quản lý infrastructure

AWS Services cho DevOps

┌──────────────────────────────────────────────────┐
│              AWS DevOps Services                 │
├──────────────────────────────────────────────────┤
│ CodeCommit  → Git repository                     │
│ CodeBuild   → Build service                      │
│ CodeDeploy  → Deployment service                 │
│ CodePipeline→ CI/CD orchestration                │
│ CloudWatch  → Monitoring & Logging               │
│ ECS/EKS     → Container orchestration            │
│ Lambda      → Serverless compute                 │
└──────────────────────────────────────────────────┘

DevOps Engineer Skills

Kỹ năng kỹ thuật

Essential Skills (Cần có):
├── Linux/Unix administration
├── Scripting (Bash, Python)
├── Git version control
├── CI/CD pipelines
├── Docker containers
└── Cloud platform (AWS/Azure/GCP)

Advanced Skills (Nâng cao):
├── Kubernetes
├── Infrastructure as Code
├── Monitoring & Observability
├── Security (DevSecOps)
└── Networking

Kỹ năng mềm

  • Communication - Làm việc với Dev và Ops
  • Problem-solving - Debug production issues
  • Automation mindset - “Automate everything”
  • Continuous learning - Tech thay đổi liên tục

RoleFocus
DevOps EngineerCI/CD, automation, infrastructure
SRE (Site Reliability Engineer)Reliability, SLOs/SLIs, incident response
Platform EngineerInternal developer platform
Cloud EngineerCloud infrastructure

Lộ trình học DevOps

Tháng 1-2: Fundamentals

  • Linux command line
  • Git version control
  • Networking basics

Tháng 3-4: Containerization

  • Docker
  • Docker Compose
  • Container registries

Tháng 5-6: CI/CD & IaC

  • GitHub Actions/Jenkins
  • Terraform
  • Ansible

Tháng 7-8: Cloud & Orchestration

  • AWS/Azure/GCP
  • Kubernetes basics
  • Monitoring

Thực hành: Setup môi trường DevOps

1. Cài đặt Git

# macOS
brew install git

# Ubuntu
sudo apt update && sudo apt install git

# Cấu hình
git config --global user.name "Your Name"
git config --global user.email "your@email.com"

2. Cài đặt Docker

# macOS - Tải Docker Desktop từ docker.com

# Ubuntu
sudo apt update
sudo apt install docker.io
sudo usermod -aG docker $USER
# Logout và login lại

# Kiểm tra
docker --version
docker run hello-world

3. Tạo GitHub Account

Truy cập github.com và tạo account miễn phí.


DevOps Metrics (DORA Metrics)

Google nghiên cứu và định nghĩa 4 key metrics:

MetricEliteHighMediumLow
Deployment FrequencyMultiple/dayWeeklyMonthly< Monthly
Lead Time for Changes< 1 hour< 1 week< 1 month> 1 month
Time to Restore Service< 1 hour< 1 day< 1 week> 1 week
Change Failure Rate0-15%16-30%31-45%> 45%

Bước tiếp theo

  1. ✅ Hiểu DevOps là gì và tại sao cần thiết
  2. ✅ Biết DevOps lifecycle và nguyên tắc
  3. 📖 Học Git - Version Control cơ bản
  4. 🚀 Tìm hiểu CI/CD Pipeline

💡 Pro tip: DevOps là journey, không phải destination. Bắt đầu từ việc nhỏ - automate một task bạn làm hàng ngày!

Bài tiếp theo: Version Control với Git - Nền tảng của mọi DevOps workflow.