Agent skill
rollback-deployment
Rollback a deployment to its previous revision. Use when a new deployment causes issues and needs to be reverted quickly. Keywords: rollback, revert, deployment, previous version, undo deployment.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/rollback-deployment
Metadata
Additional technical details for this skill
- domain
- k8s
- category
- remediation
- confidence
- 0.85
- mcp servers
-
[ "kubernetes-mcp-server" ] - requires approval
- YES
SKILL.md
Rollback Deployment
Preconditions
Before applying this skill, verify:
- Deployment name and namespace are known
- Previous revision exists
- Current revision is causing issues
Actions
1. Get Current Deployment
Check current revision and status.
mcp_tool: kubernetes-mcp-server/resources_get
params:
apiVersion: apps/v1
kind: Deployment
name: $deployment_name
namespace: $namespace
timeout: 30s
2. Get ReplicaSet History
List ReplicaSets to find previous revision.
mcp_tool: kubernetes-mcp-server/resources_list
params:
apiVersion: apps/v1
kind: ReplicaSet
namespace: $namespace
labelSelector: app=$app_label
timeout: 30s
3. Rollback to Previous Revision
Update deployment to use previous ReplicaSet's spec.
mcp_tool: kubernetes-mcp-server/resources_create_or_update
params:
resource: |
apiVersion: apps/v1
kind: Deployment
metadata:
name: $deployment_name
namespace: $namespace
annotations:
kubernetes.io/change-cause: "Rollback by kubani remediator"
spec:
template:
$previous_pod_spec
timeout: 60s
4. Verify Rollback
Confirm new pods are running with previous spec.
mcp_tool: kubernetes-mcp-server/resources_get
params:
apiVersion: apps/v1
kind: Deployment
name: $deployment_name
namespace: $namespace
timeout: 30s
Success Criteria
The skill succeeds when:
- Deployment revision incremented
- New pods running with previous spec
- All replicas available
- No pods in error state
Failure Handling
If rollback fails:
- Check if previous revision exists
- Verify resource quotas allow rollback
- Check for immutable field violations
- May need manual intervention
Examples
Input Context:
{
"deployment_name": "api-server",
"namespace": "production",
"app_label": "api-server"
}
Output:
{
"deployment": "api-server",
"previous_revision": 5,
"current_revision": 6,
"rolled_back_to": 5,
"replicas_available": 3,
"success": true
}
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?