<p>When the pod controlled by daemonset，Some error occur in the pod and it's state will be <code>CrashLoopBackOff</code>, I want to delete these pods but not delete the DaemonSet.</p>

<p>So I want to scale daemonset to 0, as far as I known, DaemonSet Spec do not support the replica of the pod.</p>

<p>How can I get there?</p>

litanhua
<p>In case you don't wanna delete the daemonset, one possible work-around is to use temporary <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector" rel="noreferrer">nodeSelector</a> with any non-existing label, for example:</p>

<pre><code>kubectl -n &lt;namespace&gt; patch daemonset &lt;name-of-daemon-set&gt; -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'
</code></pre>

<p>This will scale the daemonset down. </p>

<p>And here is the patch to remove temporary <code>nodeSelector</code>:</p>

<pre><code>kubectl -n &lt;namespace&gt; patch daemonset &lt;name-of-daemon-set&gt; --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]'
</code></pre>

<p>This will scale the daemonset up again. </p>
