<p>Is there a way to have something equivalent of : <code>kubectl rollout restart deployment my-deployment</code>
in Kubernetes Client for C#?</p>

<p>Yes, for any <code>kubectl</code> command you can run <code>kubectl --v=9</code> to see the contents of each API request and response.</p>
<p>In this case you can see the PATCH body being sent is:</p>
<pre><code>{
  &quot;spec&quot;:{
    &quot;template&quot;:{
      &quot;metadata&quot;:{
        &quot;annotations&quot;:{
          &quot;kubectl.kubernetes.io/restartedAt&quot;:&quot;2020-08-27T12:26:00+10:00&quot;
        }
      }
    }
  }
}
</code></pre>
<p>Then kubernetes controllers work out the rest.</p>
<p>Some <code>kubectl</code> commands are more client heavy and will have some logic that would need to be reimplemented. In this case, just a simple check to see if the <a href="https://github.com/kubernetes/kubectl/blob/3874cf79897cfe1e070e592391792658c44b78d4/pkg/polymorphichelpers/objectrestarter.go#L32-L37" rel="nofollow noreferrer">deployment has been &quot;paused&quot;</a></p>
<p>I'm not a c# person, but from the <a href="https://github.com/kubernetes-client/csharp/blob/master/examples/patch/Program.cs" rel="nofollow noreferrer">patch example</a> it's something like</p>
<pre><code>var dply = client.ReadNamespacedDeployment(&quot;foo&quot;, &quot;default&quot;);
var restart = new Dictionary&lt;string, string&gt;(dply.Metadata.Annotations) { [&quot;kubectl.kubernetes.io/restartedAt&quot;] = DateTime.UtcNow.ToString(&quot;s&quot;) };
var patch = new JsonPatchDocument&lt;V1Pod&gt;();
patch.Replace(e =&gt; e.Metadata.Annotations, restart);
client.PatchNamespacedDeployment(new V1Patch(patch), &quot;foo&quot;, &quot;default&quot;);
</code></pre>
