Skip to main content

Zero-Downtime Migration (Argo CD)

Migrate a Deployment managed by Argo CD to Argo Rollouts without downtime. Argo CD reverts cluster-direct changes, so scale-down of the Deployment must be done via Git commits. See workloadRef Migration for gradual migration details and ArgoCD GitOps for ignoreDifferences.


Prerequisites​

ComponentStatus
Argo CDInstalled and managing the Deployment
Argo RolloutsInstalled in cluster
Argo Rollout MCP ServerRunning (Docker recommended)
Existing DeploymentExists in target namespace, managed by Argo CD from Git

Key Principle​

Argo CD reverts cluster-direct changes. Scale-down of the Deployment must be done via Git commits (or ignoreDifferences for workloadRef). Use argo_manage_legacy_deployment(action='generate_scale_down_manifest') for the GitOps path; argo_manage_legacy_deployment(action='scale_cluster'|'delete_cluster') only for non–Argo CD–managed workloads.


Environment Setup​

Verify Argo CD and Deployment​

argocd app get hello-world
kubectl get deployment hello-world -n default
docker run --rm -it \
-p 8768:8768 \
-v ~/.kube:/app/.kube:ro \
-e K8S_KUBECONFIG=/app/.kube/config \
talkopsai/argo-rollout-mcp-server:latest

Validate Readiness Workflow​

StepActionPrompt / Tool
1Validate"Run validate_deployment_ready for hello-world in default before zero-downtime migration."
2Or use toolvalidate_deployment_ready(deployment_name="hello-world", namespace="default")
3Fix issuesAddress any blocking issues (selector, template, pod-template-hash in Service)

Convert with workloadRef Workflow (Co-Existence)​

StepActionPrompt / Tool
1Convert"Convert the hello-world deployment in default to an Argo Rollout using workloadRef mode β€” keep the existing Deployment running, scale_down=never. Apply to cluster."
2Or use toolconvert_deployment_to_rollout(deployment_name="hello-world", namespace="default", strategy="canary", migration_mode="workload_ref", scale_down="never", apply=True)
3VerifyRollout and Deployment run in parallel (co-existence)

Generate ArgoCD ignoreDifferences Workflow​

StepActionPrompt / Tool
1Generate"Generate ArgoCD ignoreDifferences for hello-world in default with include_deployment_replicas so Argo CD won't revert the Rollout's scale-down of the Deployment."
2Or use toolgenerate_argocd_ignore_differences(include_deployment_replicas=True, deployment_name="hello-world")
3Add to ApplicationPaste output into Application.spec.ignoreDifferences
4Commit and syncCommit to Git, Argo CD syncs

Update scaleDown Workflow​

StepActionPrompt / Tool
1Update"Change the workloadRef scaleDown on hello-world rollout in default to progressively."
2Or use toolargo_update_rollout(update_type='workload_ref', name="hello-world", namespace="default", scale_down="progressively")

Scale Down Deployment β€” GitOps Path (Argo CD–Managed)​

StepActionPrompt / Tool
1Generate manifest"Generate the Deployment scale-down YAML for hello-world in default β€” I'll commit it to Git for Argo CD to apply after the Rollout is stable."
2Or use toolargo_manage_legacy_deployment(action='generate_scale_down_manifest', name="hello-world", namespace="default")
3Commit to GitAdd the returned Deployment YAML (with replicas: 0) to your repo
4SyncArgo CD applies the change; Deployment scales to 0

Scale Down Deployment β€” Non-GitOps Path​

When Deployment is not managed by Argo CD:

StepActionPrompt / Tool
1Scale to 0Use tool: argo_manage_legacy_deployment(action='scale_cluster', name="hello-world", namespace="default", replicas=0)
2Verifykubectl get deployment hello-world -n default

Delete Deployment (Non-GitOps Only)​

StepActionPrompt / Tool
1DeleteUse tool: argo_manage_legacy_deployment(action='delete_cluster', name="hello-world", namespace="default")
2WarningOnly when not managed by Argo CD. Argo CD will recreate if still in Git.

Natural Language Prompts​

Copy-paste these prompts into your MCP client (Cursor, Claude, etc.).

Validate​

"Run validate_deployment_ready for hello-world in default before zero-downtime migration."

Convert (workloadRef)​

"Convert the hello-world deployment in default to an Argo Rollout using workloadRef mode β€” keep the existing Deployment running, scale_down=never. Apply to cluster."

ignoreDifferences​

"Generate ArgoCD ignoreDifferences for hello-world in default with include_deployment_replicas so Argo CD won't revert the Rollout's scale-down of the Deployment."

Scale-Down Manifest (GitOps)​

"Generate the Deployment scale-down YAML for hello-world in default β€” I'll commit it to Git for Argo CD to apply after the Rollout is stable."

Full Sequence​

"Run validate_deployment_ready for hello-world in default before zero-downtime migration."
"Generate ArgoCD ignoreDifferences for hello-world in default with include_deployment_replicas so Argo CD won't revert the Rollout's scale-down of the Deployment."
"Generate the Deployment scale-down YAML for hello-world in default β€” I'll commit it to Git for Argo CD to apply after the Rollout is stable."

Quick Reference: Tool β†’ Migration Step​

Migration StepToolNotes
1. Validate readinessvalidate_deployment_readyStructural + Service selector (no pod-template-hash)
2. Introduce Rollout (workloadRef)convert_deployment_to_rollout(migration_mode="workload_ref", scale_down="never", apply=True)Co-existence phase
3. Argo CD ignoreDifferencesgenerate_argocd_ignore_differences(include_deployment_replicas=True, deployment_name="hello-world")Prevents revert of scale-down
4. Switch trafficTraffic MCP server (out of scope)Traefik, Istio, etc.
5. Update scaleDownargo_update_rollout(update_type='workload_ref', scale_down="progressively")never β†’ onsuccess or progressively
6. Scale down DeploymentGitOps: argo_manage_legacy_deployment(action='generate_scale_down_manifest') β†’ commit YAML. Non-GitOps: argo_manage_legacy_deployment(action='scale_cluster', replicas=0)Argo CD reverts cluster-direct scale
7. Delete Deployment (optional)Non-GitOps: argo_manage_legacy_deployment(action='delete_cluster')Only when not managed by Argo CD

Troubleshooting​

IssueCheck
Argo CD reverts Deployment scale-downUse Git path: generate_scale_down_manifest β†’ commit YAML. Add include_deployment_replicas=True to ignoreDifferences.
Rollout and Deployment both runningExpected during co-existence. Update scale_down to onsuccess or progressively when ready.
Traffic not switchingTraffic switching is out of scope for this MCP server. Configure Traefik/Istio separately.
ignoreDifferences not appliedEnsure output is in Application.spec.ignoreDifferences. Sync the Application.
Deployment still in GitRemove Deployment manifest from Git repo before or after scale-down, depending on your GitOps workflow.

Next Steps​