docs(rollback): Add quick reference guide
This commit is contained in:
144
apps/demo-nginx/docs/ROLLBACK_QUICK_REF.md
Normal file
144
apps/demo-nginx/docs/ROLLBACK_QUICK_REF.md
Normal file
@@ -0,0 +1,144 @@
|
||||
# 🔄 Manual Rollback - Quick Reference
|
||||
|
||||
## 🚀 Quick Start (2 minutes)
|
||||
|
||||
```
|
||||
Jenkins → demo-nginx-rollback → Build with Parameters
|
||||
|
||||
ROLLBACK_METHOD: IMAGE_TAG
|
||||
TARGET_VERSION: main-21
|
||||
SKIP_HEALTH_CHECK: true (recommended!)
|
||||
DRY_RUN: false
|
||||
|
||||
→ Build → ✅ SUCCESS!
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📋 3 Ways to Rollback
|
||||
|
||||
### 1. By Image Tag (Fastest)
|
||||
```
|
||||
Method: IMAGE_TAG
|
||||
Target: main-21
|
||||
Use: When you know the build number
|
||||
```
|
||||
|
||||
### 2. By Revision Number
|
||||
```
|
||||
Method: REVISION_NUMBER
|
||||
Target: 2
|
||||
Use: Rollback N steps back
|
||||
Find: kubectl rollout history deployment/demo-nginx -n demo-app
|
||||
```
|
||||
|
||||
### 3. By Git Commit
|
||||
```
|
||||
Method: GIT_COMMIT
|
||||
Target: abc123def
|
||||
Use: Exact code state
|
||||
Find: git log --oneline apps/demo-nginx/deployment.yaml
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚡ Emergency Rollback (30 seconds)
|
||||
|
||||
```bash
|
||||
# Fastest - kubectl
|
||||
kubectl rollout undo deployment/demo-nginx -n demo-app
|
||||
|
||||
# To specific revision
|
||||
kubectl rollout undo deployment/demo-nginx -n demo-app --to-revision=25
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔍 Verify Rollback
|
||||
|
||||
```bash
|
||||
# Check image
|
||||
kubectl get deployment demo-nginx -n demo-app \
|
||||
-o jsonpath='{.spec.template.spec.containers[0].image}'
|
||||
|
||||
# Check pods
|
||||
kubectl get pods -n demo-app -l app=demo-nginx
|
||||
|
||||
# Test health
|
||||
POD=$(kubectl get pods -n demo-app -l app=demo-nginx -o jsonpath='{.items[0].metadata.name}')
|
||||
kubectl exec $POD -n demo-app -- wget -q -O- http://localhost/health
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Parameters
|
||||
|
||||
| Parameter | Default | Recommended |
|
||||
|-----------|---------|-------------|
|
||||
| ROLLBACK_METHOD | IMAGE_TAG | IMAGE_TAG |
|
||||
| TARGET_VERSION | (required) | main-21 |
|
||||
| SKIP_HEALTH_CHECK | false | **true** |
|
||||
| DRY_RUN | false | false |
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Common Issues - FIXED
|
||||
|
||||
| Issue | Fix | Status |
|
||||
|-------|-----|--------|
|
||||
| Wrong container name | Use `nginx` | ✅ Fixed |
|
||||
| Whitespace in input | Auto-trim | ✅ Fixed |
|
||||
| RBAC permission | Added pods/exec | ✅ Fixed |
|
||||
| Health check timing | Use SKIP_HEALTH_CHECK | ⚠️ Workaround |
|
||||
| Bash loop broken | Use `1 2 3 4 5` | ✅ Fixed |
|
||||
|
||||
---
|
||||
|
||||
## 💡 Best Practices
|
||||
|
||||
1. ✅ Always test with `DRY_RUN: true` first
|
||||
2. ✅ Use `SKIP_HEALTH_CHECK: true` for faster rollback
|
||||
3. ✅ Verify manually after rollback (30-60s wait)
|
||||
4. ✅ Document rollback reason in Jenkins build comment
|
||||
5. ✅ Check ArgoCD sync status after rollback
|
||||
|
||||
---
|
||||
|
||||
## 📊 Verification Commands
|
||||
|
||||
```bash
|
||||
# Full status check
|
||||
kubectl get deployment demo-nginx -n demo-app
|
||||
kubectl get pods -n demo-app -l app=demo-nginx
|
||||
kubectl rollout history deployment/demo-nginx -n demo-app
|
||||
|
||||
# Watch pods update
|
||||
watch kubectl get pods -n demo-app
|
||||
|
||||
# Check logs
|
||||
kubectl logs -n demo-app -l app=demo-nginx --tail=50
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Success Checklist
|
||||
|
||||
- [ ] Jenkins pipeline exists (demo-nginx-rollback)
|
||||
- [ ] RBAC configured (pods/exec permission)
|
||||
- [ ] Target version identified
|
||||
- [ ] DRY_RUN tested
|
||||
- [ ] Rollback executed
|
||||
- [ ] Pods verified (Running)
|
||||
- [ ] Image version confirmed
|
||||
- [ ] Health check passed (manual)
|
||||
- [ ] ArgoCD synced
|
||||
|
||||
---
|
||||
|
||||
## 📚 Full Documentation
|
||||
|
||||
See: [apps/demo-nginx/docs/ROLLBACK_MANUAL.md](./ROLLBACK_MANUAL.md)
|
||||
|
||||
---
|
||||
|
||||
**Quick Reference - Keep this handy! 📌**
|
||||
Reference in New Issue
Block a user