<p>For monitoring purposes, I want to rely on a pod's restartCount. However, I cannot seem to do that for certain apps, as restartCount is not reset even after rebooting the whole node the pod is scheduled to run on.</p>

<p>Usually, restarting a pod resets this, <strong>unless the pod name of the restarted pod is the same</strong> (e.g. true for etcd, kube-controller-manager, kube-scheduler and kube-apiserver).</p>

<p>For those cases, there is a <a href="https://github.com/kubernetes/kubernetes/issues/50375" rel="nofollow noreferrer">longrunning minor issue</a> as well as the idea to use <code>kubectl patch</code>.</p>

<p>To sum up the info there, <code>kubectl edit</code> will not allow to change anything in status. Unfortunately, neither does e.g.</p>

<pre><code>kubectl -n kube-system patch pod kube-controller-manager-some.node.name --type='json' -p='[{"op": "replace", "path": "/status/containerStatuses/0/restartCount", "value": 14}]'

The Pod "kube-controller-manager-some.node.name" is invalid: spec: Forbidden: pod updates may not change fields other than `spec.containers[*].image`, `spec.initContainers[*].image`, `spec.activeDeadlineSeconds` or `spec.tolerations` (only additions to existing tolerations)
</code></pre>

<p>So, I am checking if anyone has found a workaround?</p>

<p>Thanks!</p>

<p>Robert</p>

<p>This seems to be quite an old issue (2017). Take a look <a href="https://github.com/kubernetes/kubernetes/issues/54476" rel="nofollow noreferrer">here</a>.</p>

<p>I believe the solution to it was supposed to be <a href="https://github.com/kubernetes/kubernetes/pull/43420" rel="nofollow noreferrer">implementing unique UIDs for static pods</a>. This issue got reopened few days ago as <a href="https://github.com/kubernetes/kubernetes/pull/87461" rel="nofollow noreferrer">another github issue</a> and hasn't been implemented to this day.</p>

<p>I have found a workaround for it. You need to change static pod manifest file e.g. by adding some random annotation to pod.</p>

<p>Let me know if it was helpful.</p>
