SRE Reliability DevOps

SRE — Site Reliability Engineering ที่ DevOps ต้องรู้ 🚒SRE — The Site Reliability Engineering Every DevOps Team Needs 🚒

By Anirach Mingkhwan DevOps & Vibe Coding 2026 · 26 min read
SRE — วัดความน่าเชื่อถือของระบบด้วยตัวเลข
ในบทความนี้
  1. 🤔 SRE คืออะไร? ต่างจาก DevOps ยังไง?
  2. 📊 SLI / SLO / SLA — วัด Reliability ยังไง?
  3. 💰 Error Budget — งบสำหรับ "พลาด"
  4. 🚨 Incident Management — เมื่อระบบล่ม
  5. 📝 Blameless Postmortem — เรียนรู้จากความผิดพลาด
  6. 🔧 Toil Reduction — ลดงาน manual
  7. 📟 On-Call Best Practices
  8. 📈 Capacity Planning
  9. 🛡️ Chaos Engineering — ทดสอบความแข็งแกร่ง
  10. 📋 SRE Checklist — เริ่มต้นยังไง?
  11. สรุป
In this post
  1. 🤔 What Is SRE? How Is It Different from DevOps?
  2. 📊 SLI / SLO / SLA — How Do You Measure Reliability?
  3. 💰 Error Budget — A Budget for Getting It Wrong
  4. 🚨 Incident Management — When the System Goes Down
  5. 📝 Blameless Postmortem — Learning from Failure
  6. 🔧 Toil Reduction — Cutting Manual Work
  7. 📟 On-Call Best Practices
  8. 📈 Capacity Planning
  9. 🛡️ Chaos Engineering — Testing for Resilience
  10. 📋 SRE Checklist — Where Do You Start?
  11. Summary

จากโพสต์ที่แล้วเราเรียน Cloud Architecture — ออกแบบระบบบน Cloud ให้แข็งแกร่ง แต่สร้างเสร็จแล้ว... ใครจะดูแลให้มันทำงานต่อเนื่อง 24/7?

คำตอบคือ SRE — Site Reliability Engineering — แนวคิดจาก Google ที่ทำให้ "ระบบไม่ล่ม" เป็นเรื่องของ engineering ไม่ใช่โชค 🚒🐕

"SRE is what happens when you ask a software engineer to design an operations team." — Ben Treynor, VP Engineering @ Google (ผู้ก่อตั้ง SRE)

🤔 SRE คืออะไร? ต่างจาก DevOps ยังไง?

SRE (Site Reliability Engineering) คือ discipline ที่ใช้ software engineering approach มาแก้ปัญหา operations:

หลายคนงงว่า SRE กับ DevOps ต่างกันยังไง? ตารางด้านล่างจะช่วยให้เข้าใจความแตกต่างชัดเจน โดยเฉพาะการที่ SRE มีแนวคิด "วัดผลด้วยตัวเลข" และ "จำกัด toil work" ที่ชัดเจนกว่า DevOps ที่เน้นเรื่อง culture และ process เป็นหลัก

FeatureTraditional OpsDevOpsSRE
FocusดูแลระบบCulture + CI/CDReliability engineering
แนวคิดManual, ticket-basedAutomate everythingError budgets + engineering
เป้าหมายระบบรันDeploy เร็วReliable + Deploy เร็ว
Toilยอมรับลดทีละนิดจำกัด < 50% ของเวลา
Riskหลีกเลี่ยงยอมรับคำนวณด้วย Error Budget
On-callทุกปัญหาแชร์กันมีนโยบายชัดเจน

จากตารางจะเห็นว่า SRE เป็น "การทำให้ DevOps เป็นรูปธรรม" ด้วยการกำหนดเมตริกที่ชัดเจน ตัวอย่างเช่น แทนที่จะบอกว่า "ระบบต้องเสถียร" SRE จะบอกว่า "ระบบต้อง uptime 99.9%" และมีวิธีวัดผลที่ชัดเจน แนวคิด Error Budget ทำให้การสมดุลระหว่างความเสถียรและการ deploy feature ใหม่เป็นเรื่องของ data ไม่ใช่ความรู้สึก

💡 จำง่ายๆ: DevOps = "วัฒนธรรม" (philosophy) | SRE = "วิธีทำจริง" (implementation) — SRE implements DevOps

📊 SLI / SLO / SLA — วัด Reliability ยังไง?

หัวใจของ SRE คือการ วัด reliability ด้วยตัวเลข ไม่ใช่ความรู้สึก:

SLI, SLO และ SLA เป็นหัวใจสำคัญของ SRE ที่ทำให้การวัด "ความเสถียร" เป็นเรื่องของตัวเลข ไม่ใช่ความรู้สึกหรือคำพูดคลุมเครือ การเข้าใจความแตกต่างของสามตัวนี้จะช่วยให้เราออกแบบระบบและวัดผลได้อย่างมีประสิทธิภาพ

📏
SLI
Service Level Indicator
ตัววัด (metric)
latency p99 = 200ms
🎯
SLO
Service Level Objective
เป้าหมาย (target)
p99 < 300ms 99.9%
📜
SLA
Service Level Agreement
สัญญา (contract)
99.9% uptime or refund

จากไดอะแกรมเห็นได้ว่า SLI เป็นตัววัดที่เก็บข้อมูลจริงจากระบบ SLO เป็นเป้าหมายที่เรากำหนดขึ้นจาก SLI และ SLA เป็นข้อตกลงกับลูกค้าที่มี consequence จริง (เช่น คืนเงิน) หลักสำคัญคือ SLO ต้อง "เข้มงวดกว่า" SLA เพราะต้องมี buffer ไว้จัดการความเสี่ยง

SLI ที่สำคัญ — "The Four Golden Signals"

Google แนะนำให้เริ่มต้นด้วยการวัด "สี่สัญญาณทอง" ซึ่งครอบคลุมประสบการณ์ผู้ใช้และสุขภาพระบบอย่างครอบคลุม การมี SLI ทั้งสี่ตัวจะช่วยให้เราเห็นภาพรวมของระบบและสามารถตรวจจับปัญหาได้รวดเร็ว

Signalวัดอะไรตัวอย่าง SLI
🕐 Latencyเวลาตอบสนองp50 = 50ms, p99 = 200ms
📊 Trafficปริมาณ request1,500 req/sec
❌ Errorsอัตรา error0.1% of requests = 5xx
💾 Saturationใช้ resource เท่าไรCPU 70%, Memory 80%

สิ่งสำคัญคือ Latency ต้องแยก "success requests" กับ "error requests" เพราะ error มักจะเร็วกว่า (fail fast) และอาจทำให้เราไม่เห็นปัญหาจริง Traffic จะบอกความต้องการ (demand) Errors บอกคุณภาพ และ Saturation บอกขีดจำกัดของระบบ การมีทั้งสี่ตัวจะให้ภาพที่สมบูรณ์

# Prometheus — วัด SLI
# Latency (p99)
histogram_quantile(0.99,
  rate(http_request_duration_seconds_bucket[5m])
)

# Error Rate
sum(rate(http_requests_total{status=~"5.."}[5m]))
/
sum(rate(http_requests_total[5m]))

# Availability (ใน 30 วัน)
1 - (
  sum(rate(http_requests_total{status=~"5.."}[30d]))
  /
  sum(rate(http_requests_total[30d]))
)

โค้ด Prometheus ข้างต้นแสดงวิธีการคำนวณ SLI พื้นฐาน การใช้ histogram สำหรับ latency จะให้ความยืดหยุ่นในการคำนวณ percentile ต่างๆ ส่วนการคำนวณ error rate ต้องระวังเรื่อง division by zero และควรมี fallback value การคำนวณ availability แบบ 30 วันจะให้มุมมองระยะยาวที่เสถียรกว่าการดูแค่ช่วงเวลาสั้นๆ

ตัวอย่าง SLO Document

# SLO: User API Service
# ──────────────────────
# SLI: Availability
#   Definition: % of non-5xx responses
#   SLO: 99.9% over 30-day rolling window
#   Error Budget: 0.1% = ~43 minutes/month
#
# SLI: Latency
#   Definition: p99 response time
#   SLO: p99 < 300ms for 99% of requests
#
# SLI: Freshness
#   Definition: data staleness
#   SLO: 95% of reads return data < 1 min old
#
# Consequences:
#   If error budget exhausted:
#   → Freeze feature deployments
#   → Focus on reliability improvements
#   → Require SRE approval for any change

💰 Error Budget — งบสำหรับ "พลาด"

Error Budget คือ "งบ" ที่ระบบ "ผิดพลาดได้" — คำนวณจาก SLO:

Error Budget เป็นแนวคิดปฏิวัติที่ทำให้การสมดุลระหว่างความเสถียรและการพัฒนา feature ใหม่เป็นเรื่องของคณิตศาสตร์ ไม่ใช่การต่อสู้กันระหว่างทีม Dev กับ Ops ตารางด้านล่างแสดงให้เห็นว่า SLO ที่สูงขึ้น (99.99%) จะมี Error Budget น้อยมาก ซึ่งหมายความว่าต้องระมัดระวังมากขึ้นในการ deploy

SLOError Budget/เดือนError Budget/ปี
99%7.3 ชั่วโมง3.65 วัน
99.9%43.8 นาที8.76 ชั่วโมง
99.95%21.9 นาที4.38 ชั่วโมง
99.99%4.38 นาที52.6 นาที

จากตารางจะเห็นว่าความแตกต่าง 0.09% ระหว่าง 99.9% กับ 99.99% ส่งผลให้ Error Budget ต่างกัน 10 เท่า! นี่คือเหตุผลที่ SLO ต้องกำหนดให้สมเหตุสมผลกับ business requirement ไม่ใช่ยึดติดที่ "9 ยิ่งเยอะยิ่งดี" กราฟด้านล่างแสดงตัวอย่างการ track Error Budget ที่ช่วยให้ทีมเห็นภาพปัจจุบันและตัดสินใจได้ทันเวลา

Error Budget (99.9% SLO) — เดือนนี้เหลือ 65%
28 min remaining
Error Budget (99.9% SLO) — เดือนหน้า⚠️ เหลือ 15%
6.5 min left!
Error Budget (99.9% SLO) — หมด!🔴 0% — FREEZE
BUDGET EXHAUSTED — Feature freeze!

Error Budget bar ข้างต้นแสดงสถานการณ์ต่างๆ ที่อาจเกิดขึ้น เมื่อเหลือ 65% (สีเขียว) ยังสามารถ deploy ได้ตามปกติ เมื่อเหลือ 15% (สีเหลือง) ต้องเริ่มระมัดระวังและอาจต้องชะลอการ deploy บาง feature เมื่อหมด (สีแดง) ต้อง freeze การ deploy feature ใหม่ทันทีและ focus ที่การแก้ปัญหา reliability นโยบายนี้ทำให้ทีมมี incentive ที่ชัดเจนในการสร้างระบบที่เสถียร

💡 หลักการ: Error Budget เหลือเยอะ → deploy features เร็วได้ | Error Budget ใกล้หมด → ชะลอ focus reliability | Error Budget หมด → Feature Freeze!
# Grafana Dashboard — Error Budget Tracker
# ─────────────────────────────────────────
# Total requests (30d)
total = sum(increase(http_requests_total[30d]))

# Failed requests (30d)
failed = sum(increase(http_requests_total{status=~"5.."}[30d]))

# Error budget (SLO 99.9%)
budget_total = total * 0.001        # 0.1% allowed failures
budget_used  = failed
budget_remaining = (budget_total - budget_used) / budget_total * 100

# Alert เมื่อ budget < 20%
# → Slack notification to team
# → Require SRE review for deploys

🚨 Incident Management — เมื่อระบบล่ม

Severity Levels

การกำหนด severity levels ที่ชัดเจนช่วยให้ทีมสามารถ prioritize และ respond ได้อย่างเหมาะสม ไม่ใช่ว่าทุกปัญหาต้องถือเป็น "emergency" ทั้งหมด การมี response time ที่แตกต่างกันจะช่วยให้ทีมใช้พลังงานอย่างมีประสิทธิภาพและไม่เกิด burnout

LevelImpactResponse Timeตัวอย่าง
P1 CriticalService down ทั้งหมด< 5 นาทีProduction database down
P2 HighMajor feature พัง< 30 นาทีPayment ไม่ทำงาน
P3 MediumMinor feature พัง< 4 ชั่วโมงSearch ช้ากว่าปกติ
P4 LowCosmetic / minorNext business dayTypo ในหน้า error

จากตารางจะเห็นว่า P1 เป็นเรื่องจริงจัง (5 นาที) เพราะ impact ต่อ user ทั้งหมด ส่วน P4 สามารถรอได้เพราะไม่กระทบ functionality หลักการสำคัญคือ "impact ต่อ user" ไม่ใช่ว่า server ตัวไหนพัง เช่น monitoring server down อาจเป็นแค่ P3 ถ้าไม่กระทบ user experience โดยตรง

Incident Response Flow

กระบวนการ incident response ต้องมีขั้นตอนที่ชัดเจนและฝึกซ้อมเป็นประจำ ไม่ใช่รอให้เกิดปัญหาจริงแล้วค่อยคิดว่าต้องทำอะไร flow ด้านล่างเน้น "mitigation ก่อน investigation" เพราะการหยุดปัญหาสำคัญกว่าการหา root cause ในช่วงแรก

🚨 Detect
Alert fired
→
📞 Triage
Assess severity
→
🔧 Mitigate
Stop bleeding
→
✅ Resolve
Fix root cause
→
📝 Postmortem
Learn & prevent

Flow นี้แสดงให้เห็นว่าการ "detect" เร็วมีความสำคัญมาก และการ "mitigate" ไม่จำเป็นต้องเป็น permanent fix อาจเป็นการ rollback หรือ workaround ก่อน จุดสำคัญคือ Postmortem ไม่ใช่ "optional" แต่เป็นส่วนหนึ่งของ incident response เพื่อป้องกันปัญหาเดิมไม่ให้เกิดซ้ำ

Incident Timeline ตัวอย่าง

Timeline ที่ดีจะแสดงให้เห็น decision making process และ lesson learned การจดเวลาที่แม่นยำช่วยให้ postmortem มีความน่าเชื่อถือ และการ track action items จะทำให้การตอบสนองใน incident ครั้งต่อไปดีขึ้น ตัวอย่างด้านล่างแสดง incident ที่ resolve ภายใน 12 นาที ซึ่งถือว่าเร็วมาก

14:23 UTC — Alert Fired
PagerDuty: "Error rate > 5%" — On-call SRE notified
14:25 UTC — Acknowledged
SRE สมชาย joined war room, opened incident channel #inc-2026-042
14:30 UTC — Root Cause Found
Deploy v2.4.1 มี memory leak → pods OOMKilled → cascading failure
14:32 UTC — Mitigated
Rollback to v2.4.0 via argocd app rollback
14:35 UTC — Resolved
Error rate back to normal, all pods healthy
14:40 UTC — Comms
Status page updated, customer notification sent

จาก timeline จะเห็นว่าการมี deployment tool ที่ดี (ArgoCD) ทำให้ rollback ได้เร็ว (2 นาที) การ communicate กับ customer ทำหลังจากระบบ stable แล้ว ไม่ใช่ตอนที่กำลัง firefighting อยู่ การจด timeline แบบนี้จะกลายเป็น input สำคัญของ postmortem เพื่อวิเคราะห์ว่าทำอะไรได้ดี ทำอะไรควรปรับปรุง

Incident Commander — Roles

# Incident Roles (P1/P2)
# ──────────────────────
# 🎖️ Incident Commander (IC)
#    - ตัดสินใจ, coordinate, สั่งการ
#    - ไม่ต้อง debug เอง
#
# 🔧 Technical Lead
#    - วิเคราะห์ root cause
#    - Execute mitigation
#
# 📢 Communications Lead
#    - อัพเดท status page
#    - แจ้ง stakeholders
#    - เขียน customer comms
#
# 📝 Scribe
#    - จด timeline ทุกอย่าง
#    - Record decisions & actions

📝 Blameless Postmortem — เรียนรู้จากความผิดพลาด

Postmortem คือ document ที่เขียนหลังเกิด incident — เน้น "เรียนรู้" ไม่ใช่ "โทษคน" (blameless!):

Blameless postmortem เป็นหัวใจสำคัญของ SRE culture เพราะถ้าคนกลัวถูกโทษ จะไม่มีใครอยากรายงานปัญหาหรือเขียน postmortem ที่ซื่อสัตย์ การสร้าง culture ที่เน้น "เรียนรู้จากความผิดพลาด" จะทำให้ระบบแข็งแกร่งขึ้นในระยะยาว template ด้านล่างแสดงโครงสร้างที่ครบถ้วนของ postmortem ที่ดี

# Postmortem Template
# ═══════════════════

## Incident: Production API Outage
## Date: 2026-03-07 14:23-14:35 UTC
## Duration: 12 minutes
## Severity: P1
## Impact: 100% of API requests failed for 12 minutes
##         ~18,000 failed requests, ~2,400 users affected

## Summary
Deploy v2.4.1 contained a memory leak in the user session
handler. Under load, pods exceeded memory limits and were
OOMKilled. The auto-scaler created new pods that also crashed,
causing a cascading failure.

## Root Cause
Memory leak in UserSessionMiddleware — each request allocated
a new 2MB buffer that was never garbage collected due to a
circular reference. Under 500 req/s, memory grew ~1GB/min.

## Timeline
- 14:20 — Deploy v2.4.1 rolled out (3/6 pods)
- 14:23 — Alert: Error rate > 5%
- 14:25 — IC assigned, war room opened
- 14:30 — Identified memory leak in v2.4.1
- 14:32 — Rollback to v2.4.0
- 14:35 — Service restored

## What Went Well
- Alert fired within 3 minutes of impact
- Quick rollback via ArgoCD (2 minutes)
- Clear incident response process followed

## What Went Wrong
- No memory profiling in CI pipeline
- Load test only ran at 100 req/s (prod = 500 req/s)
- Canary deployment was skipped for "small change"

## Action Items
1. [P1] Add memory leak detection to CI — @somchai — Due: Mar 14
2. [P1] Load test at 2x production traffic — @somying — Due: Mar 14
3. [P2] Enforce canary deployment for all changes — @team — Due: Mar 21
4. [P3] Add OOMKill alert (before cascade) — @ops — Due: Mar 28

## Lessons Learned
- "Small changes" can have big impacts — always canary
- Memory profiling should be part of CI, not manual
- Rollback capability (ArgoCD) saved us — invest in it

จาก postmortem template จะเห็นว่าการแยก "What Went Well" กับ "What Went Wrong" ช่วยให้เกิด balanced view ไม่ใช่โฟกัสแค่สิ่งที่ผิดพลาด Action Items ต้องมี owner และ due date ที่ชัดเจน ไม่ใช่แค่ "เราจะปรับปรุง" อย่างคลุมเครือ การ track action items completion เป็นสิ่งสำคัญที่บ่อยครั้งถูกมองข้าม

🐕 Blameless Culture: "สมชาย deploy code ที่มี bug" → ❌ | "ระบบไม่มี memory check ใน CI pipeline ที่จะ catch bug นี้" → ✅

🔧 Toil Reduction — ลดงาน manual

Toil = งานที่ manual, ซ้ำๆ, automate ได้, ไม่มี lasting value — Google กำหนดว่า SRE ต้องใช้เวลาทำ toil ไม่เกิน 50%:

Toil (ลดให้ได้)Engineering (เพิ่มให้ได้)
Restart services ด้วยมือสร้าง auto-restart + self-healing
Manually scale serversAuto-scaling policies
Copy-paste deployment stepsCI/CD pipeline automation
ตอบ ticket "reset password"Self-service password reset
ดู logs ด้วยตาAutomated anomaly detection
Manual certificate renewalcert-manager auto-renew

จากตารางเปรียบเทียบจะเห็นว่า toil มักจะเป็นงานที่ซ้ำซาก คาดการณ์ได้ และไม่สร้างคุณค่าระยะยาว ส่วน engineering work จะสร้าง "leverage" คือลงทุนครั้งเดียวแต่ได้ประโยชน์ต่อเนื่อง การแปลง manual task เป็น automation ไม่ใช่แค่การเขียน script แต่รวมถึงการออกแบบ monitoring, error handling และ maintenance ระยะยาว

# วัด Toil — track เวลาที่ใช้
# ──────────────────────────
# Week 1: SRE Team Time Breakdown
#
# Engineering work:  25 hours (50%)  ← target: > 50%
# Toil:              15 hours (30%)  ← target: < 50%
# On-call:            5 hours (10%)
# Training/misc:      5 hours (10%)
#
# Top Toil Items:
# 1. Manual DB backups         — 4h/week → AUTOMATE
# 2. Certificate renewals      — 3h/week → cert-manager
# 3. Capacity request tickets  — 3h/week → self-service
# 4. Log investigation         — 5h/week → better alerting

การ track เวลาแบบนี้จะให้ insight ที่ชัดเจนว่าทีมใช้เวลาไปกับอะไรบ้าง การมี target 50% engineering work ไม่ใช่ตัวเลขมหัศจรรย์ แต่เป็น guideline ที่ช่วยให้ทีมไม่จมอยู่กับงาน manual จนไม่มีเวลาปรับปรุงระบบ การระบุ "Top Toil Items" จะช่วยให้ prioritize การ automate ตาม impact


📟 On-Call Best Practices

On-Call Rotation

# PagerDuty Schedule Example
# ──────────────────────────
# Primary:   สมชาย → สมหญิง → สมศักดิ์ (rotate weekly)
# Secondary: สมศักดิ์ → สมชาย → สมหญิง (backup)
#
# Rules:
# - Primary responds within 5 min (P1) / 30 min (P2)
# - If no response in 10 min → escalate to Secondary
# - If no response in 20 min → escalate to Engineering Manager
#
# Compensation:
# - On-call allowance per week
# - Time off after high-severity incidents
# - No more than 25% of time on-call per quarter

โครงสร้าง on-call ข้างต้นแสดงระบบ rotation ที่สมดุลระหว่าง coverage และ fairness การมี secondary backup ช่วยลดความเครียดของ primary และสร้าง safety net การจำกัดไม่เกิน 25% ต่อไตรมาสช่วยป้องกัน burnout ที่สำคัญคือการมี escalation path ที่ชัดเจนเพื่อไม่ให้เกิดสถานการณ์ที่ on-call engineer ต้องรับผิดชอบเกินขีดจำกัด

Alerting — Alert ที่ดี vs Alert ที่แย่

การออกแบบ alerting ที่ดีเป็นศิลปะที่ต้องสมดุลระหว่าง "จับปัญหาได้ครบ" กับ "ไม่รบกวนโดยไม่จำเป็น" Alert fatigue คือศัตรูใหญ่ของ SRE เพราะเมื่อ alert มากเกินไป คนจะเริ่มเพิกเฉยแม้กระทั่งปัญหาจริง หลักสำคัญคือ alert ต้อง "actionable" เสมอ

✅ Alert ที่ดี❌ Alert ที่แย่
Actionable — ต้องทำอะไรสักอย่างInformational — แค่รู้ไว้
User-facing impactInternal metric spike
"Error rate > 1% for 5 min""CPU > 80% for 1 min"
มี runbook linkไม่มีบอกว่าต้องทำอะไร
Alert fatigue ต่ำAlert ทุก 5 นาที (noise!)

จากตารางจะเห็นว่า alert ที่ดีมุ่งเน้น "impact ต่อ user" ไม่ใช่ "server metrics" เพราะ CPU สูงไม่ได้แปลว่า user ได้รับผลกระทบเสมอไป การมี runbook link ช่วยให้ on-call engineer สามารถ respond ได้เร็ว โดยเฉพาะช่วงกลางคืนหรือคนใหม่ที่ยังไม่คุ้นเคยระบบ

# Prometheus Alert Rules
groups:
  - name: sre-alerts
    rules:
      # ✅ ดี: User-facing, actionable
      - alert: HighErrorRate
        expr: |
          sum(rate(http_requests_total{status=~"5.."}[5m]))
          / sum(rate(http_requests_total[5m])) > 0.01
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "Error rate > 1% for 5 minutes"
          runbook: "https://wiki.example.com/runbooks/high-error-rate"
          dashboard: "https://grafana.example.com/d/api-overview"

      # ✅ ดี: SLO-based alert
      - alert: ErrorBudgetBurnRate
        expr: |
          error_budget_remaining < 0.2
        labels:
          severity: warning
        annotations:
          summary: "Error budget < 20% remaining this month"
          action: "Consider slowing deployments"

      # ❌ แย่: CPU alert (not user-facing)
      # - alert: HighCPU
      #   expr: cpu_usage > 80
      #   → CPU สูงไม่ได้แปลว่า user ได้รับผลกระทบ!

Prometheus alert rules ข้างต้นแสดงความแตกต่างระหว่าง alert ที่ดีกับแย่ HighErrorRate alert เน้น user impact และมี context ครบ (runbook, dashboard) Error Budget alert เป็น proactive warning ที่ช่วยป้องกันปัญหาก่อนเกิด ส่วน CPU alert ถูก comment ออกเพราะไม่ relate กับ user experience โดยตรง ข้อสำคัญคือ `for: 5m` ช่วยกรอง transient spike


📈 Capacity Planning

Capacity Planning คือการ "เดาอนาคต" อย่างมีหลักการ แทนที่จะรอให้ระบบ overload แล้วค่อย panic buying การทำ forecasting ด้วย data จะช่วยให้วางแผนและจัดซื้อ infrastructure ได้ทันเวลา โดยเฉพาะในยุคที่ hardware procurement ใช้เวลานาน

# Capacity Planning Questions
# ──────────────────────────
# 1. ปัจจุบันใช้ resource เท่าไร? (baseline)
# 2. Growth rate เท่าไร? (trend)
# 3. เมื่อไรจะถึง limit? (forecast)
# 4. ต้องเพิ่มอะไร เมื่อไร? (plan)

# PromQL — Forecast disk full
predict_linear(
  node_filesystem_avail_bytes{mountpoint="/"}[7d],
  30 * 24 * 3600    # predict 30 days ahead
) < 0
# → Alert: "Disk will be full in < 30 days"

# PromQL — Traffic growth trend
rate(http_requests_total[30d])
# → ถ้าโต 20%/month → plan capacity 3 months ahead

PromQL ข้างต้นแสดงการใช้ predict_linear() ในการคาดการณ์ disk usage และ traffic growth การ predict 30 วันข้างหน้าให้เวลาเพียงพอในการ procure resource ใหม่ แต่ต้องระวังว่า linear prediction อาจไม่เหมาะกับ seasonal traffic หรือ sudden spike การมี alert ที่แจ้งล่วงหน้าจะช่วยให้ไม่ต้องมา firefighting ตอนดึก


🛡️ Chaos Engineering — ทดสอบความแข็งแกร่ง

Chaos Engineering = ทำลายระบบตัวเองก่อนที่ระบบจริงจะพัง เพื่อหาจุดอ่อน:

Chaos Engineering คือการ "ทำลายระบบตัวเอง" อย่างมีเป้าหมายเพื่อค้นหาจุดอ่อนก่อนที่มันจะพังจริงในเวลาที่ไม่เหมาะ การทำ controlled failure จะช่วยให้เราเข้าใจพฤติกรรมของระบบในสถานการณ์ที่ไม่ปกติ และเตรียม recovery process ให้พร้อม

# Chaos Experiments ที่ควรทำ
# ──────────────────────────
# 1. Kill random pod       → K8s จะสร้างใหม่มั้ย?
# 2. Increase latency      → App handle timeout ดีมั้ย?
# 3. Fill disk 100%        → Alert ทันมั้ย? App crash มั้ย?
# 4. Kill database primary → Failover ทำงานมั้ย?
# 5. DNS failure           → Retry logic ทำงานมั้ย?
# 6. Network partition     → Split-brain มั้ย?

# LitmusChaos — K8s Chaos Engineering
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
  name: pod-kill-test
spec:
  appinfo:
    appns: production
    applabel: app=myapp
  chaosServiceAccount: litmus-admin
  experiments:
    - name: pod-delete
      spec:
        components:
          env:
            - name: TOTAL_CHAOS_DURATION
              value: '30'          # 30 seconds of chaos
            - name: CHAOS_INTERVAL
              value: '10'          # kill pod every 10 sec
            - name: FORCE
              value: 'true'

รายการ chaos experiments ข้างต้นเริ่มจากสิ่งง่ายๆ (kill pod) ไปยังซับซ้อนขึ้น (network partition) LitmusChaos configuration แสดงการทดสอบ pod resilience โดยการ kill pod ทุก 10 วินาทีเป็นเวลา 30 วินาที การตั้ง FORCE=true จะทำ immediate kill ไม่ใช่ graceful shutdown เพื่อจำลอง real-world failure ที่มักจะเป็น unexpected

💡 กฎ Chaos: เริ่มจาก staging ก่อน → ค่อยทำ production | ทำในเวลาทำการ (มีคนดู) | มี rollback plan เสมอ

📋 SRE Checklist — เริ่มต้นยังไง?

การเริ่มต้น SRE ในองค์กรต้องทำทีละขั้น ไม่ใช่กระโดดไปทำทั้งหมดพร้อมกัน เพราะ SRE ต้องอาศัยทั้ง technical implementation และ culture change ที่ใช้เวลา checklist ด้านล่างเรียงตามลำดับความสำคัญ โดย foundation (ข้อ 1-3) ต้องแข็งแกร่งก่อนไปขั้นตอนถัดไป

  1. กำหนด SLIs — วัด latency, error rate, availability
  2. ตั้ง SLOs — เป้าหมายที่สมเหตุสมผล (ไม่ต้อง 100%!)
  3. Track Error Budget — dashboard แสดง budget remaining
  4. Setup Alerting — SLO-based alerts, ไม่ใช่ CPU/memory alerts
  5. Incident Process — severity levels, response playbooks, war room
  6. Blameless Postmortems — เขียนทุก P1/P2, track action items
  7. Reduce Toil — measure → automate → measure อีก
  8. On-Call Policy — rotation, compensation, escalation
  9. Capacity Planning — forecast growth, plan ahead
  10. Chaos Engineering — break it before it breaks itself

การเริ่มที่ SLI/SLO ไม่ใช่เพราะมันง่าย แต่เพราะมันเป็น "ภาษาร่วม" ที่ทำให้ทีมคุยกันรู้เรื่อง เมื่อมี SLO แล้ว error budget จะตามมาเป็นธรรมชาติ และ alerting จะมี direction ที่ชัดเจน การทำ postmortem ที่ blameless จะค่อยๆ เปลี่ยน culture และขั้นตอนสุดท้ายจะช่วย optimize ระบบให้แข็งแกร่งขึ้น


สรุป

  • SRE = Software engineering approach to operations — "SRE implements DevOps"
  • SLI/SLO/SLA = วัด reliability ด้วยตัวเลข (Indicator → Objective → Agreement)
  • Four Golden Signals = Latency, Traffic, Errors, Saturation
  • Error Budget = "งบสำหรับพลาด" — หมด = feature freeze!
  • Incident Management = Detect → Triage → Mitigate → Resolve → Postmortem
  • Blameless Postmortem = โทษระบบ ไม่โทษคน → สร้าง culture ที่เรียนรู้
  • Toil < 50% = วัด manual work แล้ว automate ให้ได้
  • Chaos Engineering = ทดสอบความแข็งแกร่งก่อนจะพังจริง 🚒🐕

In the previous post we covered Cloud Architecture — designing a resilient system on the cloud. But once it is built... who keeps it running 24/7?

The answer is SRE — Site Reliability Engineering — the idea from Google that turns "the system doesn't go down" into a matter of engineering rather than luck 🚒🐕

"SRE is what happens when you ask a software engineer to design an operations team." — Ben Treynor, VP Engineering @ Google (the founder of SRE)

🤔 What Is SRE? How Is It Different from DevOps?

SRE (Site Reliability Engineering) is the discipline of applying a software engineering approach to operations problems:

Plenty of people are unsure how SRE differs from DevOps. The table below makes the difference clear — in particular, SRE carries a much more explicit notion of "measure it with numbers" and "cap the toil work" than DevOps, which is mostly about culture and process.

FeatureTraditional OpsDevOpsSRE
FocusKeeping the system aliveCulture + CI/CDReliability engineering
ApproachManual, ticket-basedAutomate everythingError budgets + engineering
GoalThe system runsDeploy fastReliable + deploy fast
ToilAcceptedChipped away atCapped at < 50% of the time
RiskAvoidedAcceptedCalculated with an error budget
On-callEvery problemSharedGoverned by an explicit policy

The table shows that SRE is "DevOps made concrete" through clearly defined metrics. Instead of saying "the system must be stable", SRE says "the system must have 99.9% uptime" and specifies exactly how that is measured. The error budget idea turns the balance between stability and shipping new features into a question of data rather than of feelings.

💡 An easy way to remember it: DevOps = "the culture" (philosophy) | SRE = "how it is actually done" (implementation) — SRE implements DevOps

📊 SLI / SLO / SLA — How Do You Measure Reliability?

The heart of SRE is measuring reliability with numbers, not with feelings:

SLI, SLO and SLA are the core of SRE: they turn "stability" into numbers rather than a feeling or a vague phrase. Understanding how the three differ helps us design systems and measure them effectively.

📏
SLI
Service Level Indicator
the measurement (metric)
latency p99 = 200ms
🎯
SLO
Service Level Objective
the target
p99 < 300ms 99.9%
📜
SLA
Service Level Agreement
the contract
99.9% uptime or refund

The diagram shows that the SLI is the measurement collected from the real system, the SLO is the target we set based on that SLI, and the SLA is the agreement with the customer that carries a real consequence (a refund, for instance). The key rule is that the SLO must be stricter than the SLA, because you need a buffer to absorb risk.

The SLIs that matter — "The Four Golden Signals"

Google recommends starting with the "four golden signals", which together cover both the user experience and the health of the system. Having all four gives you a full picture and lets you catch problems quickly.

SignalWhat it measuresExample SLI
🕐 LatencyResponse timep50 = 50ms, p99 = 200ms
📊 TrafficRequest volume1,500 req/sec
❌ ErrorsError rate0.1% of requests = 5xx
💾 SaturationHow much resource is in useCPU 70%, Memory 80%

The important detail is that latency must separate successful requests from failed ones, because errors are usually faster (fail fast) and can hide the real problem. Traffic tells you the demand, errors tell you the quality, and saturation tells you the system's limit. All four together give the complete picture.

# Prometheus — measuring SLIs
# Latency (p99)
histogram_quantile(0.99,
  rate(http_request_duration_seconds_bucket[5m])
)

# Error Rate
sum(rate(http_requests_total{status=~"5.."}[5m]))
/
sum(rate(http_requests_total[5m]))

# Availability (over 30 days)
1 - (
  sum(rate(http_requests_total{status=~"5.."}[30d]))
  /
  sum(rate(http_requests_total[30d]))
)

The Prometheus code above shows how to compute the basic SLIs. Using a histogram for latency gives you the flexibility to compute any percentile later. For the error rate, watch out for division by zero and provide a fallback value. Computing availability over a 30-day window gives a longer-term view that is far steadier than looking at a short interval.

An example SLO document

# SLO: User API Service
# ──────────────────────
# SLI: Availability
#   Definition: % of non-5xx responses
#   SLO: 99.9% over 30-day rolling window
#   Error Budget: 0.1% = ~43 minutes/month
#
# SLI: Latency
#   Definition: p99 response time
#   SLO: p99 < 300ms for 99% of requests
#
# SLI: Freshness
#   Definition: data staleness
#   SLO: 95% of reads return data < 1 min old
#
# Consequences:
#   If error budget exhausted:
#   → Freeze feature deployments
#   → Focus on reliability improvements
#   → Require SRE approval for any change

💰 Error Budget — A Budget for Getting It Wrong

An error budget is the "budget" a system has for failing — computed from the SLO:

The error budget is a revolutionary idea: it turns the balance between stability and new feature work into arithmetic rather than a fight between Dev and Ops. The table below shows that a higher SLO (99.99%) leaves a very small error budget, which means far more care is needed on every deploy.

SLOError budget/monthError budget/year
99%7.3 hours3.65 days
99.9%43.8 minutes8.76 hours
99.95%21.9 minutes4.38 hours
99.99%4.38 minutes52.6 minutes

The table shows that the 0.09% gap between 99.9% and 99.99% makes the error budget ten times smaller. This is exactly why an SLO has to be set to match a business requirement rather than chasing "more nines is always better". The bars below show what tracking an error budget looks like in practice, so the team can see where it stands and decide in time.

Error Budget (99.9% SLO) — this month65% left
28 min remaining
Error Budget (99.9% SLO) — next month⚠️ 15% left
6.5 min left!
Error Budget (99.9% SLO) — gone!🔴 0% — FREEZE
BUDGET EXHAUSTED — Feature freeze!

The error budget bars above show the situations you are likely to meet. At 65% left (green) you can keep deploying as usual. At 15% left (amber) you need to start being careful and may have to hold back some features. When it is gone (red) you freeze new feature deploys immediately and focus on fixing reliability. This policy gives the team a clear incentive to build a stable system.

💡 The principle: Plenty of error budget left → deploy features fast | Error budget running low → slow down, focus on reliability | Error budget exhausted → feature freeze!
# Grafana Dashboard — Error Budget Tracker
# ─────────────────────────────────────────
# Total requests (30d)
total = sum(increase(http_requests_total[30d]))

# Failed requests (30d)
failed = sum(increase(http_requests_total{status=~"5.."}[30d]))

# Error budget (SLO 99.9%)
budget_total = total * 0.001        # 0.1% allowed failures
budget_used  = failed
budget_remaining = (budget_total - budget_used) / budget_total * 100

# Alert when budget < 20%
# → Slack notification to team
# → Require SRE review for deploys

🚨 Incident Management — When the System Goes Down

Severity levels

Clearly defined severity levels let the team prioritize and respond appropriately — not every problem is an "emergency". Having different response times for different levels lets the team spend its energy well and avoid burnout.

LevelImpactResponse TimeExample
P1 CriticalService completely down< 5 minutesProduction database down
P2 HighMajor feature broken< 30 minutesPayments not working
P3 MediumMinor feature broken< 4 hoursSearch slower than usual
P4 LowCosmetic / minorNext business dayTypo on the error page

The table shows that P1 is serious business (5 minutes) because it affects every user, while P4 can wait because it does not touch functionality. The guiding principle is "impact on the user", not which server broke — a monitoring server going down may only be a P3 if it does not directly affect the user experience.

Incident response flow

The incident response process needs clear steps that are rehearsed regularly, rather than waiting for a real outage and then working out what to do. The flow below puts "mitigation before investigation", because stopping the damage matters more than finding the root cause in those first minutes.

🚨 Detect
Alert fired
→
📞 Triage
Assess severity
→
🔧 Mitigate
Stop bleeding
→
✅ Resolve
Fix root cause
→
📝 Postmortem
Learn & prevent

This flow shows how much detecting quickly matters, and that mitigating does not have to be a permanent fix — a rollback or a workaround will do. The important point is that the postmortem is not "optional": it is part of the incident response, and it is what stops the same problem happening again.

An example incident timeline

A good timeline shows the decision-making process and the lessons learned. Recording accurate times makes the postmortem credible, and tracking the action items makes the response to the next incident better. The example below is an incident resolved in 12 minutes, which is very fast.

14:23 UTC — Alert Fired
PagerDuty: "Error rate > 5%" — On-call SRE notified
14:25 UTC — Acknowledged
SRE Somchai joined the war room, opened incident channel #inc-2026-042
14:30 UTC — Root Cause Found
Deploy v2.4.1 had a memory leak → pods OOMKilled → cascading failure
14:32 UTC — Mitigated
Rollback to v2.4.0 via argocd app rollback
14:35 UTC — Resolved
Error rate back to normal, all pods healthy
14:40 UTC — Comms
Status page updated, customer notification sent

The timeline shows that having a good deployment tool (ArgoCD) makes the rollback fast — two minutes. Communication with customers happens after the system is stable, not while the team is still firefighting. A timeline recorded like this becomes a key input to the postmortem, where you work out what went well and what needs improving.

Incident commander — the roles

# Incident Roles (P1/P2)
# ──────────────────────
# 🎖️ Incident Commander (IC)
#    - Decides, coordinates, gives direction
#    - Does not debug personally
#
# 🔧 Technical Lead
#    - Analyses the root cause
#    - Executes the mitigation
#
# 📢 Communications Lead
#    - Updates the status page
#    - Informs stakeholders
#    - Writes the customer comms
#
# 📝 Scribe
#    - Records every step of the timeline
#    - Records decisions & actions

📝 Blameless Postmortem — Learning from Failure

A postmortem is the document written after an incident — focused on "learning", not "blaming people" (blameless!):

The blameless postmortem is central to SRE culture, because if people fear blame nobody will want to report a problem or write an honest postmortem. Building a culture that learns from failure is what makes a system stronger over the long run. The template below shows the full structure of a good postmortem.

# Postmortem Template
# ═══════════════════

## Incident: Production API Outage
## Date: 2026-03-07 14:23-14:35 UTC
## Duration: 12 minutes
## Severity: P1
## Impact: 100% of API requests failed for 12 minutes
##         ~18,000 failed requests, ~2,400 users affected

## Summary
Deploy v2.4.1 contained a memory leak in the user session
handler. Under load, pods exceeded memory limits and were
OOMKilled. The auto-scaler created new pods that also crashed,
causing a cascading failure.

## Root Cause
Memory leak in UserSessionMiddleware — each request allocated
a new 2MB buffer that was never garbage collected due to a
circular reference. Under 500 req/s, memory grew ~1GB/min.

## Timeline
- 14:20 — Deploy v2.4.1 rolled out (3/6 pods)
- 14:23 — Alert: Error rate > 5%
- 14:25 — IC assigned, war room opened
- 14:30 — Identified memory leak in v2.4.1
- 14:32 — Rollback to v2.4.0
- 14:35 — Service restored

## What Went Well
- Alert fired within 3 minutes of impact
- Quick rollback via ArgoCD (2 minutes)
- Clear incident response process followed

## What Went Wrong
- No memory profiling in CI pipeline
- Load test only ran at 100 req/s (prod = 500 req/s)
- Canary deployment was skipped for "small change"

## Action Items
1. [P1] Add memory leak detection to CI — @somchai — Due: Mar 14
2. [P1] Load test at 2x production traffic — @somying — Due: Mar 14
3. [P2] Enforce canary deployment for all changes — @team — Due: Mar 21
4. [P3] Add OOMKill alert (before cascade) — @ops — Due: Mar 28

## Lessons Learned
- "Small changes" can have big impacts — always canary
- Memory profiling should be part of CI, not manual
- Rollback capability (ArgoCD) saved us — invest in it

The template shows how separating "What Went Well" from "What Went Wrong" produces a balanced view instead of focusing only on the failures. Action items need an owner and a due date — not a vague "we will improve". Tracking those action items through to completion is the part that most often gets overlooked.

🐕 Blameless culture: "Somchai deployed buggy code" → ❌ | "The system has no memory check in the CI pipeline that would have caught this bug" → ✅

🔧 Toil Reduction — Cutting Manual Work

Toil = work that is manual, repetitive, automatable, and has no lasting value — Google's rule is that an SRE should spend no more than 50% of their time on toil:

Toil (reduce this)Engineering (increase this)
Restarting services by handBuild auto-restart + self-healing
Manually scale serversAuto-scaling policies
Copy-paste deployment stepsCI/CD pipeline automation
Answering "reset password" ticketsSelf-service password reset
Reading logs by eyeAutomated anomaly detection
Manual certificate renewalcert-manager auto-renew

The comparison shows that toil tends to be repetitive, predictable and without lasting value, while engineering work creates leverage — you invest once and keep benefiting. Turning a manual task into automation is not just writing a script: it also means designing the monitoring, the error handling and the long-term maintenance.

# Measuring toil — track where the time goes
# ──────────────────────────────────────────
# Week 1: SRE Team Time Breakdown
#
# Engineering work:  25 hours (50%)  ← target: > 50%
# Toil:              15 hours (30%)  ← target: < 50%
# On-call:            5 hours (10%)
# Training/misc:      5 hours (10%)
#
# Top Toil Items:
# 1. Manual DB backups         — 4h/week → AUTOMATE
# 2. Certificate renewals      — 3h/week → cert-manager
# 3. Capacity request tickets  — 3h/week → self-service
# 4. Log investigation         — 5h/week → better alerting

Tracking time like this gives a clear picture of where the team's hours actually go. The 50% engineering target is not a magic number, but a guideline that stops the team drowning in manual work with no time left to improve the system. Naming the "Top Toil Items" lets you prioritize what to automate by impact.


📟 On-Call Best Practices

On-call rotation

# PagerDuty Schedule Example
# ──────────────────────────
# Primary:   Somchai → Somying → Somsak (rotate weekly)
# Secondary: Somsak → Somchai → Somying (backup)
#
# Rules:
# - Primary responds within 5 min (P1) / 30 min (P2)
# - If no response in 10 min → escalate to Secondary
# - If no response in 20 min → escalate to Engineering Manager
#
# Compensation:
# - On-call allowance per week
# - Time off after high-severity incidents
# - No more than 25% of time on-call per quarter

The on-call structure above balances coverage against fairness. A secondary backup takes pressure off the primary and creates a safety net, and capping on-call at 25% of the quarter guards against burnout. Most important is a clear escalation path, so the on-call engineer is never left carrying more than they can handle.

Alerting — a good alert vs a bad one

Designing good alerting is an art of balancing "catch every problem" against "don't interrupt people for nothing". Alert fatigue is the great enemy of SRE: when there are too many alerts, people start ignoring even the real ones. The rule is that an alert must always be actionable.

✅ A good alert❌ A bad alert
Actionable — something has to be doneInformational — just so you know
User-facing impactInternal metric spike
"Error rate > 1% for 5 min""CPU > 80% for 1 min"
Has a runbook linkSays nothing about what to do
Low alert fatigueAlerts every 5 minutes (noise!)

The table shows that a good alert is about "impact on the user", not "server metrics" — high CPU does not always mean users are affected. A runbook link lets the on-call engineer respond quickly, especially in the middle of the night or when they are new and do not yet know the system.

# Prometheus Alert Rules
groups:
  - name: sre-alerts
    rules:
      # ✅ Good: user-facing, actionable
      - alert: HighErrorRate
        expr: |
          sum(rate(http_requests_total{status=~"5.."}[5m]))
          / sum(rate(http_requests_total[5m])) > 0.01
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "Error rate > 1% for 5 minutes"
          runbook: "https://wiki.example.com/runbooks/high-error-rate"
          dashboard: "https://grafana.example.com/d/api-overview"

      # ✅ Good: SLO-based alert
      - alert: ErrorBudgetBurnRate
        expr: |
          error_budget_remaining < 0.2
        labels:
          severity: warning
        annotations:
          summary: "Error budget < 20% remaining this month"
          action: "Consider slowing deployments"

      # ❌ Bad: CPU alert (not user-facing)
      # - alert: HighCPU
      #   expr: cpu_usage > 80
      #   → High CPU does not mean users are affected!

The Prometheus alert rules above show the difference between a good alert and a bad one. HighErrorRate is about user impact and carries full context (runbook, dashboard). The error budget alert is a proactive warning that heads off a problem before it happens. The CPU alert is commented out because it does not relate directly to the user experience. And note that `for: 5m` is what filters out transient spikes.


📈 Capacity Planning

Capacity planning is "guessing the future" in a principled way, instead of waiting for the system to overload and then panic-buying. Forecasting from data lets you plan and procure infrastructure in time — which matters especially in an era when hardware procurement is slow.

# Capacity Planning Questions
# ──────────────────────────
# 1. How much resource are we using now? (baseline)
# 2. What is the growth rate? (trend)
# 3. When do we hit the limit? (forecast)
# 4. What do we add, and when? (plan)

# PromQL — Forecast disk full
predict_linear(
  node_filesystem_avail_bytes{mountpoint="/"}[7d],
  30 * 24 * 3600    # predict 30 days ahead
) < 0
# → Alert: "Disk will be full in < 30 days"

# PromQL — Traffic growth trend
rate(http_requests_total[30d])
# → if it grows 20%/month → plan capacity 3 months ahead

The PromQL above shows how to use predict_linear() to forecast disk usage and traffic growth. Predicting 30 days out gives you enough time to procure new resources — but be careful, because a linear prediction may not suit seasonal traffic or a sudden spike. An alert that fires in advance is what saves you from firefighting late at night.


🛡️ Chaos Engineering — Testing for Resilience

Chaos engineering = break your own system before the real one breaks, to find the weak points:

Chaos engineering means breaking your own system deliberately, to find the weak points before they fail at the worst possible moment. Controlled failure teaches us how the system behaves in abnormal conditions and gets the recovery process ready.

# Chaos experiments worth running
# ──────────────────────────
# 1. Kill random pod       → will K8s create a new one?
# 2. Increase latency      → does the app handle timeouts well?
# 3. Fill disk 100%        → does the alert fire in time? does the app crash?
# 4. Kill database primary → does failover work?
# 5. DNS failure           → does the retry logic work?
# 6. Network partition     → do we get split-brain?

# LitmusChaos — K8s Chaos Engineering
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
  name: pod-kill-test
spec:
  appinfo:
    appns: production
    applabel: app=myapp
  chaosServiceAccount: litmus-admin
  experiments:
    - name: pod-delete
      spec:
        components:
          env:
            - name: TOTAL_CHAOS_DURATION
              value: '30'          # 30 seconds of chaos
            - name: CHAOS_INTERVAL
              value: '10'          # kill pod every 10 sec
            - name: FORCE
              value: 'true'

The list of chaos experiments above starts simple (kill a pod) and works up to the complex (network partition). The LitmusChaos configuration tests pod resilience by killing a pod every 10 seconds for 30 seconds. Setting FORCE=true makes it an immediate kill rather than a graceful shutdown, to simulate the real-world failures that are usually unexpected.

💡 The chaos rules: start in staging, then move to production | run it during working hours (with people watching) | always have a rollback plan

📋 SRE Checklist — Where Do You Start?

Adopting SRE in an organization has to happen one step at a time, not all at once, because SRE needs both technical implementation and a culture change that takes time. The checklist below is ordered by priority: the foundation (items 1–3) has to be solid before you move on.

  1. Define your SLIs — measure latency, error rate, availability
  2. Set your SLOs — reasonable targets (they do not have to be 100%!)
  3. Track the error budget — a dashboard showing the budget remaining
  4. Set up alerting — SLO-based alerts, not CPU/memory alerts
  5. Incident process — severity levels, response playbooks, war room
  6. Blameless postmortems — write one for every P1/P2, track the action items
  7. Reduce toil — measure → automate → measure again
  8. On-call policy — rotation, compensation, escalation
  9. Capacity planning — forecast growth, plan ahead
  10. Chaos engineering — break it before it breaks itself

Starting with SLI/SLO is not because it is easy, but because it is the shared language that lets the team talk to each other. Once the SLO exists, the error budget follows naturally, and alerting gains a clear direction. Blameless postmortems gradually shift the culture, and the final steps optimize the system into something genuinely resilient.


Summary

  • SRE = Software engineering approach to operations — "SRE implements DevOps"
  • SLI/SLO/SLA = measuring reliability with numbers (Indicator → Objective → Agreement)
  • Four Golden Signals = Latency, Traffic, Errors, Saturation
  • Error Budget = "a budget for getting it wrong" — exhausted = feature freeze!
  • Incident Management = Detect → Triage → Mitigate → Resolve → Postmortem
  • Blameless Postmortem = blame the system, not the person → build a culture that learns
  • Toil < 50% = measure the manual work, then automate it away
  • Chaos Engineering = test resilience before it breaks for real 🚒🐕
บทความจากซีรีส์ DevOps & Vibe Coding 2026From the DevOps & Vibe Coding 2026 series
← Previous
Cloud Architecture — ออกแบบระบบบน Cloud ให้แข็งแกร่ง
Next →
GitHub Actions — Automate ทุกอย่างใน CI/CD Pipeline