run-chaos-experiment
정보
이 스킬은 개발자가 쿠버네티스 환경에서 Litmus 또는 Chaos Mesh를 사용해 카오스 엔지니어링 실험을 설계하고 실행할 수 있게 합니다. 제어된 장애 주입을 통해 시스템 복원력을 테스트하고, 장애 가설을 검증하며, 복구 프로세스를 개선합니다. 주요 출시 전, 아키텍처 변경 후 또는 복원력 훈련 중에 사용하여 시스템의 신뢰성을 사전에 강화하세요.
빠른 설치
Claude Code
추천npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/run-chaos-experimentClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
行混驗
控注故以測且改系韌也。
用
- 大釋前(負測)→用
- 構改後(驗韌)→用
- GameDay 或災復演→用
- 驗故模假→用
- SRE 熟度計畫→用
入
- 必:Kubernetes 叢(Litmus 或 Chaos Mesh)
- 必:穩態定(「常」貌)
- 必:假設(如「一 pod 死,API 仍可用」)
- 可:察棧(Prometheus、Grafana)量影
- 可:回退計
行
一:定穩態與假
文錄常態:
## Steady State Definition
### Service: API Gateway
- **Availability**: 99.9% (< 0.1% error rate)
- **Latency**: p95 < 200ms
- **Throughput**: 1000 req/s
## Hypothesis
"If one API pod is killed, the remaining pods will handle the load with <5s
disruption and no increase in error rate."
得:明、可量之常與成準。
敗:穩態不可定→察不足,先增指。
二:限爆徑
縮驗以減險:
# chaos-config.yaml
apiVersion: v1
kind: Namespace
metadata:
name: chaos-testing
設護:
## Blast Radius Controls
### Environment
- **Scope**: Staging only (first 5 runs)
- **Production**: Only after 5 successful staging runs
- **Timing**: Business hours (09:00-17:00 local)
### Auto-Abort Conditions
- Error rate >10% for >30 seconds
得:驗有界、不傾全系。
敗:徑過大→縮範。一非關服始。
三:裝 Chaos Mesh
# Add Chaos Mesh Helm repo
helm repo add chaos-mesh https://charts.chaos-mesh.org
helm repo update
# Install Chaos Mesh
helm install chaos-mesh chaos-mesh/chaos-mesh \
--namespace chaos-mesh \
--create-namespace \
--set dashboard.create=true \
--set controllerManager.replicaCount=1
# Verify
kubectl get pods -n chaos-mesh
# Dashboard
kubectl port-forward -n chaos-mesh svc/chaos-dashboard 2333:2333
替:Litmus(中立):
kubectl apply -f https://litmuschaos.github.io/litmus/litmus-operator-v2.14.0.yaml
kubectl get pods -n litmus
得:Chaos Mesh 或 Litmus 行、面板可達。
敗:查 RBAC。混工需叢級權。
四:建行驗
例:Pod Kill(Chaos Mesh):
# pod-kill-experiment.yaml
apiVersion: chaos-mesh.org/v1alpha1
kind: PodChaos
metadata:
name: api-pod-kill-test
namespace: chaos-testing
spec:
action: pod-kill
mode: one
selector:
namespaces:
- production
labelSelectors:
app: api-gateway
chaos-enabled: "true"
duration: "30s"
施驗:
kubectl apply -f pod-kill-experiment.yaml
kubectl get podchaos -n chaos-testing -w
kubectl describe podchaos api-pod-kill-test -n chaos-testing
察影於 Grafana:
rate(http_requests_total{status=~"5..", job="api"}[1m])
histogram_quantile(0.95, rate(http_request_duration_seconds_bucket{job="api"}[1m]))
rate(kube_pod_container_status_restarts_total{pod=~"api-.*"}[5m])
得:pod 死、k8s 重啟、服續微擾。
敗:誤率躍或服衰→停驗、查。
五:析果迭
書驗報:
# Chaos Experiment Report
**Hypothesis**: API stays available if one pod crashes
**Tool**: Chaos Mesh
## Results
- **Error Rate**: 0.1% → 2.3% (8s)
- **Recovery Time**: 8 seconds
## Hypothesis Outcome
**FAILED**: Error rate exceeded 1% threshold
## Improvements Made
1. Reduced readiness probe interval: 10s → 2s
2. Added pre-stop hook: 5-second sleep
記驗於日誌:
date,experiment,environment,status,error_rate_peak,recovery_time_s,outcome
2025-02-09,pod-kill-api,staging,complete,2.3%,8,failed
得:習得記、修施、後驗約。
敗:驗後無動→混工程為戲。優先修。
六:升至產(慎)
預驗常過後:
apiVersion: chaos-mesh.org/v1alpha1
kind: PodChaos
metadata:
name: api-pod-kill-prod
spec:
action: pod-kill
duration: "10s"
scheduler:
cron: "0 10 * * 2"
產護:
kubectl create configmap chaos-killswitch \
-n chaos-testing \
--from-literal=enabled=true
得:產驗於低險窗、急停備。
敗:產驗致事故→立禁、覆盤。
驗
- 穩態與假明定
- 爆徑限(境、範、時)
- 混工裝測
- 預驗成
- 果文錄附指析
- 修施
- 後驗驗修
- 產驗僅於 ≥ 5 預成後
忌
- 無假:「看何發」費時。必有假
- 範過廣:殺諸 pod 為災復測,非韌測。始小
- 產先:勿首於產。預先恆
- 忽果:無動之混為戲。修所學
- 警疲:混驗觸警。Grafana 註或靜期警
- 無停計:失控時需急停。備之
參
setup-prometheus-monitoringconfigure-alerting-rulesdefine-slo-sli-sla
GitHub 저장소
연관 스킬
evaluating-llms-harness
테스팅이 Claude Skill은 MMLU, GSM8K를 포함한 60개 이상의 표준화된 학술 과제에서 LLM 성능을 벤치마크하기 위해 lm-evaluation-harness를 실행합니다. 개발자들이 모델 품질을 비교하고, 학습 진행 상황을 추적하거나 학술 결과를 보고할 수 있도록 설계되었습니다. 이 도구는 HuggingFace와 vLLM 모델을 포함한 다양한 백엔드를 지원합니다.
cloudflare-cron-triggers
테스팅이 스킬은 cron 표현식을 사용하여 Worker를 스케줄링하기 위한 Cloudflare Cron Triggers 구현에 관한 포괄적인 지식을 제공합니다. 주기적 작업, 유지보수 작업, 자동화된 워크플로우 설정 방법을 다루며, 잘못된 cron 표현식이나 시간대 문제 같은 일반적인 이슈들을 해결하는 방법을 포함합니다. 개발자들은 이를 통해 스케줄된 핸들러 구성, cron 트리거 테스트, Workflows 및 Green Compute와의 연동 작업을 수행할 수 있습니다.
webapp-testing
테스팅이 Claude Skill은 Python 스크립트를 통해 로컬 웹 애플리케이션을 테스트하기 위한 Playwright 기반 툴킷을 제공합니다. 프론트엔드 검증, UI 디버깅, 스크린샷 캡처, 로그 확인 기능을 지원하며 서버 라이프사이클을 관리합니다. 브라우저 자동화 작업에 사용하되 컨텍스트 오염을 방지하기 위해 소스 코드를 읽지 않고 스크립트를 직접 실행하세요.
finishing-a-development-branch
테스팅이 스킬은 테스트 통과를 확인한 후 체계적인 통합 옵션을 제시하여 개발자가 완성된 작업을 마무리하도록 돕습니다. 구현이 완료된 후 머지, PR 생성, 브랜치 정리와 같은 워크플로우를 안내합니다. 코드가 준비되고 테스트가 완료되었을 때 개발 프로세스를 체계적으로 마무리하기 위해 사용하세요.
