원클릭으로
rollback
Emergency rollback procedure for production ML service — Argo Rollouts abort + kubectl undo + MLflow revert + alert silencing
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Emergency rollback procedure for production ML service — Argo Rollouts abort + kubectl undo + MLflow revert + alert silencing
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Scaffold and run batch scoring jobs (CronJob + Parquet output) that reuse the service's model + feature-engineering code without opening the live API
Root-cause a performance alert using sliced metrics + ground-truth
Review cloud costs against budget and identify optimization opportunities
Debug ML inference issues — latency spikes, wrong predictions, event loop blocking
Deploy ML service to EKS with Kustomize overlays and IRSA
Deploy ML service to GKE with Kustomize overlays and Workload Identity
| name | rollback |
| description | Emergency rollback procedure for production ML service — Argo Rollouts abort + kubectl undo + MLflow revert + alert silencing |
| allowed-tools | ["Read","Grep","Glob","Bash(kubectl:*)","Bash(kubectl-argo-rollouts:*)","Bash(mlflow:*)","Bash(amtool:*)","Bash(curl:*)","Bash(gh:*)"] |
| when_to_use | Use during an active production incident: metric regression confirmed, canary failure escalated to users, bad release of model or image, or drift/performance alert that the team decides must be reverted NOW rather than waiting for the next retrain cycle. Examples: 'rollback bankchurn to previous version', 'revert the deploy from last hour', 'emergency undo', 'something went wrong post-deploy'. |
| argument-hint | <service-name> [target-revision] |
| arguments | ["service-name"] |
| authorization_mode | {"analyze":"AUTO","execute_rollback":"STOP","silence_alerts":"CONSULT","close_incident":"CONSULT"} |
This is the MOST CRITICAL skill in on-call. It must be predictable, idempotent, and auditable. Execution is STOP-class: the agent produces the plan; a human approves each destructive command.
concept-drift-analysis first. Rollback has its own blast radius.Before running the plan, verify:
kubectl config current-context points at the affected clusterkubectl argo rollouts version is available OR kubectl with the
rollout subcommand for plain Deploymentsrepo + actions scopes for issue creationmlflow experiments list) Incident declared
│
┌────────────┴────────────┐
Argo Rollouts? Plain Deployment?
│ │
kubectl argo rollouts kubectl rollout undo
abort + undo deployment/{service}
│ │
└────────────┬────────────┘
│
Wait for Ready (kubectl rollout status)
│
┌────────────┴────────────┐
Model changed? Image-only change?
(MLflow revert) (done)
│
MLflow transition_model_version_stage
Previous → Production
│
POST /model/reload to each pod (or restart)
│
Silence incident-related alerts
│
Open audit issue (labels: rollback, incident)
# Who is firing?
kubectl get prometheusrules -n monitoring -o json | \
jq '.items[].spec.groups[].rules[] | select(.alert != null) | .alert'
# Current rollout state
kubectl argo rollouts get rollout {service}-predictor -n {namespace}
# Recent deploys
kubectl rollout history deployment/{service}-predictor -n {namespace}
kubectl argo rollouts history {service}-predictor -n {namespace}
Agent outputs a short evidence pack: alert names, revisions, timestamps.
Pick the revision to revert to. The agent proposes the IMMEDIATELY PREVIOUS healthy revision unless the operator specifies otherwise.
# For Argo Rollouts (default in this template)
kubectl argo rollouts get rollout {service}-predictor -n {namespace} \
-o json | jq '.status.history[] | {revision, status, images: [.template.spec.containers[].image]}'
# For plain Deployment
kubectl rollout history deployment/{service}-predictor -n {namespace} --revision=<N-1>
Agent emits [AGENT MODE: STOP] with the proposed target.
Once the operator confirms the target revision:
# Immediately stop any in-progress canary
kubectl argo rollouts abort {service}-predictor -n {namespace}
# Roll back to the last stable revision (K-1 in the history)
kubectl argo rollouts undo {service}-predictor -n {namespace} \
--to-revision={target-revision}
# Wait until the new stable is fully rolled out
kubectl argo rollouts status {service}-predictor -n {namespace} \
--watch --timeout 10m
kubectl rollout undo deployment/{service}-predictor -n {namespace} \
--to-revision={target-revision}
kubectl rollout status deployment/{service}-predictor -n {namespace} \
--timeout 10m
An image-only rollback (code fix, dependency fix) does not require this step. But if the bad release included a new model artifact promoted in MLflow Registry, the artifact ALSO must move back:
python - <<PY
import mlflow
c = mlflow.tracking.MlflowClient()
# Previous production version → Production
# Current production version → Archived
c.transition_model_version_stage('{service}Model', version={previous}, stage='Production')
c.transition_model_version_stage('{service}Model', version={current}, stage='Archived')
print('MLflow registry reverted')
PY
# Trigger pods to pick up the old model (init container re-downloads)
kubectl rollout restart deployment/{service}-predictor -n {namespace}
# OR hot-reload without restart:
for pod in $(kubectl get pods -l app={service} -n {namespace} -o name); do
kubectl exec -n {namespace} $pod -- curl -s -X POST http://localhost:8000/model/reload
done
Alerts that were caused BY the incident will self-resolve as the rollback propagates. But alerts already queued MUST be silenced to prevent downstream paging. Proposed silence duration: 2h. Always extend rather than let alerts fire again before the postmortem.
# Alertmanager silence (requires amtool or /api/v2/silences)
amtool silence add \
alertname=~"({AlertA}|{AlertB})" \
service={service} \
--duration=2h \
--comment="Rollback in progress — ref: incident {incident-id}" \
--author="rollback-skill"
# Pods Ready?
kubectl get pods -l app={service} -n {namespace}
# Readiness probe returns 200?
kubectl exec -n {namespace} <pod> -- curl -s http://localhost:8000/ready
# Error rate back down?
curl -s 'http://prometheus.monitoring:9090/api/v1/query?query=sum(rate({service}_requests_total{status=~"5.."}[2m]))/sum(rate({service}_requests_total[2m]))'
# Score distribution returned to stable-version profile?
curl -s 'http://prometheus.monitoring:9090/api/v1/query?query=histogram_quantile(0.5,sum(rate({service}_prediction_score_bucket[5m]))by(le))'
All four signals must return to pre-incident baselines before the rollback is declared complete.
Create an incident issue with all the evidence gathered above:
gh issue create \
--title "Rollback: {service} {incident-id}" \
--body "$(cat <<EOF
## Incident summary
- Start: {start-ts}
- End: {rollback-complete-ts}
- Duration: {duration}
- User impact: {brief}
## Rollback evidence
- Rolled back: rev {current} → rev {previous}
- MLflow model: v{N} → v{N-1}
- Alerts silenced: {list}
## Metrics
- Error rate pre/post: {before}% → {after}%
- p95 latency pre/post: {before}ms → {after}ms
## Next steps
- [ ] Postmortem scheduled for {date}
- [ ] Regression test added to tests/regression/
- [ ] Blameless RCA doc in docs/incidents/{date}-{service}.md
EOF
)" \
--label "rollback,incident,postmortem-needed"
Within 5 business days, the on-call owner MUST:
docs/incidents/{YYYY-MM-DD}-{service}.md