<p>This is not a Helm issue. You are probably trying to update the LabelSelector fields which are immutable. This is expected behaviour as per the <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#label-selector-updates" rel="nofollow noreferrer">kubernetes</a>.</p>

CC BY-SA 4.0
2021-12-03T10:55:39.137Z
This is not helpful at all, yes, it is obvious that it is kubernetes, but how do you suggest to go with production deployments? The whole point of helm is to update/replace pods without downtime.
Aram
CC BY-SA 4.0
2021-06-11T02:01:55.317Z
2021-06-11T02:01:55.317Z
rohatgisanat
<p>I was running the older <a href="https://github.com/chartmuseum/charts/releases/tag/chartmuseum-2.16.0" rel="nofollow noreferrer">2.16.0</a> version of ChartMuseum Helm Chart. I am trying to update it to use newer <a href="https://github.com/chartmuseum/charts/releases/tag/chartmuseum-3.1.0" rel="nofollow noreferrer">3.1.0</a>. When I try to upgrade using <code>helm upgrade &lt;release&gt; &lt;name&gt; -n &lt;namespace&gt;</code>, the upgrade fails with the following error:</p>
<pre><code>Error: UPGRADE FAILED: cannot patch &quot;...&quot; with kind Deployment: Deployment.apps &quot;...&quot; is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{&quot;app.kubernetes.io/instance&quot;:&quot;chart-rep&quot;, &quot;app.kubernetes.io/name&quot;:&quot;chartmuseum&quot;}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
</code></pre>
<p>I am not sure but I believe this is because of helm v3? I was going through <code>[this][3]</code> page where I found helm v3 is a prerequisite.
The change from 2.16.0 to 3.1.0 requires helm v3.</p>
<p>I also have a pv bound to older version and  ideally I want it to bind to the newer one.I am also using <code>rolling-update</code> strategy.</p>
<p>What steps do I need to take so that the upgrade works?</p>

<kubernetes><helm><kubernetes-helm>
Helm - UPGRADE FAILED: cannot patch "..." with kind Deployment: Deployment.apps
ray an
# Helm - UPGRADE FAILED: cannot patch "..." with kind Deployment: Deployment.apps

(Asked by: username_0 on 2021-06-08)

I was running the older 2.16.0 version of ChartMuseum Helm Chart. I am trying to update it to use newer 3.1.0. When I try to upgrade using helm upgrade   -n , the upgrade fails with the following error:
Error: UPGRADE FAILED: cannot patch "..." with kind Deployment: Deployment.apps "..." is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/instance":"chart-rep", "app.kubernetes.io/name":"chartmuseum"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable

I am not sure but I believe this is because of helm v3? I was going through [this][3] page where I found helm v3 is a prerequisite.
The change from 2.16.0 to 3.1.0 requires helm v3.
I also have a pv bound to older version and  ideally I want it to bind to the newer one.I am also using rolling-update strategy.
What steps do I need to take so that the upgrade works?

**Tags:** kubernetes, helm, kubernetes-helm


---

## 1 answers

### Answer by username_1 on 2021-06-11. Score: 3 | Accepted answer

This is not a Helm issue. You are probably trying to update the LabelSelector fields which are immutable. This is expected behaviour as per the [kubernetes](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#label-selector-updates).

> **Comments:**
> **username_2**: This is not helpful at all, yes, it is obvious that it is kubernetes, but how do you suggest to go with production deployments? The whole point of helm is to update/replace pods without downtime.  

---

