Agent skill
deploy-via-gitops
Deploy application changes via GitOps workflow. Updates manifests in Git, triggers Flux reconciliation, and verifies deployment. Use for safe, auditable deployments. Keywords: deploy, gitops, flux, reconcile, release, rollout, git, manifest.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/deploy-via-gitops
Metadata
Additional technical details for this skill
- domain
- general
- category
- gitops
- confidence
- 0.8
- mcp servers
-
[ "kubernetes-mcp-server" ] - requires approval
- YES
SKILL.md
Deploy via GitOps
Preconditions
Before applying this skill, verify:
- GitOps repository access configured
- Flux CD watching the repository
- Target namespace exists
- Image exists in registry
Actions
1. Prepare Manifest Changes
Identify files to update:
manifest_paths:
- gitops/apps/{app-name}/deployment.yaml
- gitops/apps/{app-name}/kustomization.yaml
changes:
- type: image_tag
field: spec.template.spec.containers[*].image
new_value: "{registry}/{image}:{tag}"
- type: replicas
field: spec.replicas
new_value: N
2. Update Git Repository
Commit changes to GitOps repo:
# Clone or update repository
repo = git.Repo(gitops_path)
repo.remotes.origin.pull()
# Make changes
update_deployment_image(deployment_path, new_image)
# Commit and push
repo.index.add([deployment_path])
repo.index.commit(f"chore(gitops): Update {app_name} to {tag}")
repo.remotes.origin.push()
3. Trigger Flux Reconciliation
Force immediate sync:
command: flux reconcile kustomization {kustomization-name} --with-source
options:
- --namespace=flux-system
- --timeout=5m
wait_for:
- type: Ready
status: "True"
4. Monitor Rollout
Watch deployment progress:
# Wait for rollout
while not deployment_ready:
status = get_deployment_status(app_name, namespace)
if status.ready_replicas == status.replicas:
deployment_ready = True
elif status.conditions.has_failure:
raise DeploymentFailed(status.conditions.message)
await asyncio.sleep(5)
5. Verify Deployment
Confirm successful deployment:
verifications:
- check: deployment_ready
resource: deployment/{app-name}
condition: availableReplicas >= desiredReplicas
- check: pods_healthy
selector: app={app-name}
condition: all pods Running/Ready
- check: endpoint_responding
url: http://{service-name}/health
expected_status: 200
6. Record Deployment Result
Log deployment outcome:
deployment_record:
app: string
version: string
previous_version: string
status: success|failed|rolled_back
timestamp: datetime
duration_seconds: number
commit_sha: string
deployed_by: agent|user
Success Criteria
The skill succeeds when:
- Manifest changes committed to Git
- Flux reconciliation completed
- Deployment rollout successful
- Verification checks passed
Failure Handling
If deployment fails:
- Git push failed: Retry with backoff, report auth error
- Reconciliation failed: Check Flux logs, report Kustomize errors
- Rollout failed: Auto-rollback if configured, notify
- Verification failed: Consider rollback, alert operators
Rollback Procedure
If rollback needed:
rollback_steps:
1. git_revert:
command: git revert HEAD
push: true
2. force_reconcile:
command: flux reconcile kustomization {name} --with-source
3. verify_rollback:
check: previous version running
4. notify:
channel: discord
message: "Rolled back {app} due to: {reason}"
Examples
Input Context:
{
"app_name": "k8s-monitor",
"namespace": "ai-agents",
"new_image": "registry.almckay.io/k8s-monitor:0.2.0-abc1234",
"gitops_path": "gitops/apps/ai-agents/k8s-monitor"
}
Expected Output:
{
"success": true,
"deployment": {
"app": "k8s-monitor",
"version": "0.2.0-abc1234",
"previous_version": "0.1.9-def5678",
"namespace": "ai-agents"
},
"git": {
"commit_sha": "abc123def456", # pragma: allowlist secret
"branch": "main",
"message": "chore(gitops): Update k8s-monitor to 0.2.0-abc1234"
},
"flux": {
"reconciled": true,
"kustomization": "apps",
"duration_seconds": 45
},
"verification": {
"deployment_ready": true,
"pods_healthy": true,
"ready_replicas": 1
}
}
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?