If you’re upgrading ArgoCD using Helm and hit this error:
UPGRADE FAILED: cannot patch "argocd-redis-ha-haproxy" with kind Deployment:
spec.selector: Invalid value: field is immutable
π This is a common issue during ArgoCD upgrades—especially when Helm chart versions change.
π§ What This Error Means
Kubernetes is telling you:
- You are trying to modify an immutable field
- Specifically:
spec.selectorin a Deployment
π Immutable fields cannot be changed after resource creation.
π Why This Happens During ArgoCD Upgrade
- You upgraded ArgoCD via Helm
- The chart version changed labels/selectors
- Kubernetes rejects the patch
π Example resource:
argocd-redis-ha-haproxy
The selector changed between versions—triggering the error.
π¦ Step 1: Check Current ArgoCD Chart Version
helm list -n argocd
π Step 2: Check Available Chart Versions
helm search repo argo/argo-cd --versions
π Compare current vs target version carefully.
⚠️ Step 3: Check for Breaking Changes
- Label changes
- Selector updates
- Component changes (Redis HA, HAProxy)
π This is usually where the issue originates.
𧬠Why Upgrade Fails (Flow)
π³ CloudChef Recipe: Fix ArgoCD Upgrade Error
π‘ Tip: Copy commands directly using the copy button
π₯ Step 1: Delete the Problematic Deployment
kubectl delete deployment argocd-redis-ha-haproxy -n argocd
---
⚡ Step 2: Re-run Helm Upgrade
helm upgrade argocd argo/argo-cd -n argocd
---
π‘️ Step 3: Alternative (Force Upgrade)
helm upgrade argocd argo/argo-cd -n argocd --force
---
π Step 4: Validate Deployment
kubectl get pods -n argocd
---
⚠️ Important Considerations
- Deleting deployments may cause downtime
- Always validate in staging first
- Backup configs before upgrade
⚡ Best Practices for ArgoCD Upgrades
- Check chart versions before upgrading
- Read release notes carefully
- Avoid skipping versions
- Use staging for testing
π« Common Mistakes
- ❌ Upgrading blindly
- ❌ Ignoring immutable errors
- ❌ Modifying selectors manually
π Related CloudChef Guides
π₯ CloudChef Pro Tip
When you see:
field is immutable
π Think:
- Chart version changed
- Resource must be recreated
- Not patched
π Final Thoughts
This error isn’t a bug—it’s Kubernetes enforcing safe deployments.
π₯ CloudChef Tip: Treat upgrades as migrations, not simple updates.
No comments:
Post a Comment