<p>I am trying to update status subresource for a Custom Resource and I see a discrepency with curl and <code>kubectl patch</code> commands. when I use curl call it works perfectly fine but when I use <code>kubectl patch</code> command it says patched but with <code>no change</code>. Here are the command that I used</p>
<p><strong>Using Curl:</strong></p>
<p>When I connect to <code>kubectl proxy</code> and run the below curl call, it's successful and updates status subresource on my CR.</p>
<pre><code>curl -XPATCH  -H &quot;Accept: application/json&quot; -H &quot;Content-Type: application/json-patch+json&quot;  --data '[{&quot;op&quot;: &quot;replace&quot;, &quot;path&quot;: &quot;/status/state&quot;, &quot;value&quot;: &quot;newState&quot;}]' 'http://127.0.0.1:8001/apis/acme.com/v1alpha1/namespaces/acme/myresource/default/status'
</code></pre>
<p><strong>Kubectl patch command:</strong></p>
<p>Using kubectl patch says the CR is patch but with <code>no change</code> and the status sub-resource is updated.</p>
<pre><code>$ kubectl -n acme patch myresource default --type='json' -p='[{&quot;op&quot;: &quot;replace&quot;, &quot;path&quot;: &quot;/status/state&quot;, &quot;value&quot;:&quot;newState&quot;}]'
myresource.acme.com/default patched (no change)
</code></pre>
<p>However when I do the <code>kubectl patch</code> on the other sub-resources like <code>spec</code> it works fine. Am i missing something here?</p>

user3435964
<p>As of kubectl v1.24, it is possible to patch subresources with an additional flag e.g. <code>--subresource=status</code>. This flag is considered &quot;Alpha&quot; but does not require enabling the feature.</p>
<p>As an example, with a yaml merge:</p>
<pre><code>kubectl patch MyCrd myresource --type=merge --subresource status --patch 'status: {healthState: InSync}'
</code></pre>
<p>The <a href="https://sysdig.com/blog/kubernetes-1-24-whats-new/#2590" rel="nofollow noreferrer">Sysdig &quot;What's New?&quot; for v1.24</a> includes some more words about this flag:</p>
<blockquote>
<p>Some kubectl commands like get, patch, edit, and replace will now contain a new flag --subresource=[subresource-name], which will allow fetching and updating status and scale subresources for all API resources.</p>
<p>You now can stop using complex curl commands to directly update subresources.</p>
</blockquote>
<p>The <code>--subresource</code> flag is scheduled for promotion to &quot;Beta&quot; in Kubernetes v1.27 through <a href="https://github.com/kubernetes/enhancements/pull/3729" rel="nofollow noreferrer">KEP-2590: graduate kubectl subresource support to beta</a>. The lifecycle of this feature can be tracked in <a href="https://github.com/kubernetes/enhancements/issues/2590" rel="nofollow noreferrer">#2590 Add subresource support to kubectl</a>.</p>
