<p>I'm trying to modify the running state of my pod, managed by a deployment controller both from command line via <code>kubectl patch</code> and from the k8s python client API. Neither of them seem to work</p>
<p>From the command line, I tried both strategic merge match and JSON merge patch, but neither of them works. For e.g. I'm trying to patch the pod conditions to make the <code>status</code> field to <code>False</code></p>
<pre class="lang-sh prettyprint-override"><code>kubectl -n foo-ns patch pod foo-pod-18112 -p '{
  &quot;status&quot;: {
    &quot;conditions&quot;: [
      {
        &quot;type&quot;: &quot;PodScheduled&quot;,
        &quot;status&quot;: &quot;False&quot;
      },
      {
        &quot;type&quot;: &quot;Ready&quot;,
        &quot;status&quot;: &quot;False&quot;
      },
      {
        &quot;type&quot;: &quot;ContainersReady&quot;,
        &quot;status&quot;: &quot;False&quot;
      },
      {
        &quot;type&quot;: &quot;Initialized&quot;,
        &quot;status&quot;: &quot;False&quot;
      }
    ],
    &quot;phase&quot;: &quot;Running&quot;
  }
}' --type merge
</code></pre>
<p>From the python API</p>
<pre class="lang-py prettyprint-override"><code># definition of various pod states
ready_true        = { &quot;type&quot;: &quot;Ready&quot;, &quot;status&quot;: &quot;True&quot; }
ready_false       = { &quot;type&quot;: &quot;Ready&quot;, &quot;status&quot;: &quot;False&quot; }
scheduled_true    = { &quot;type&quot;: &quot;PodScheduled&quot;, &quot;status&quot;: &quot;True&quot; }
cont_ready_true   = { &quot;type&quot;: &quot;ContainersReady&quot;, &quot;status&quot;: &quot;True&quot; }
cont_ready_false  = { &quot;type&quot;: &quot;ContainersReady&quot;, &quot;status&quot;: &quot;False&quot; }
initialized_true  = { &quot;type&quot;: &quot;Initialized&quot;, &quot;status&quot;: &quot;True&quot; }
initialized_false = { &quot;type&quot;: &quot;Initialized&quot;, &quot;status&quot;: &quot;False&quot; }

patch = {&quot;status&quot;: { &quot;conditions&quot;: [ready_false, initialized_false, cont_ready_false, scheduled_true ], &quot;phase&quot; : &quot;Running&quot; }}

p_status = v1.patch_namespaced_pod_status(podname, &quot;default&quot;,  body=patch)
</code></pre>
<p>While running the above snippet, I don't see any errors and the response <code>p_status</code> has all the pod conditions modified as applied in the <code>patch</code>, but I don't see any events from API server related to this pod status change.</p>
<p>May be the deployment controller is rolling back the changes to a working config? I'm looking for ways to patch the pod conditions and test if my custom controller (not related to the question) is able to see those new pod conditions.</p>

Inian
<p>You should not.</p>
<p>Clients write the <em>desired state</em> in the <code>spec:</code> and controllers write the <code>status:</code>-part.</p>
