<p>I want to run an app on any node. It should always have at least one instance per node, but more instances are allowed, primarily during an update to prevent downtime of that pod (and node).</p>

<p>Kubernetes deployment updates usually work by launching a new pod, and as soon as it is available the old one is terminated. That's perfect, but in my case I need a DaemonSet to launch a specific app on all nodes at all times. However, when updating this DaemonSet, Kubernetes kills a pod one by one (i.e. node by node) and <strong>then</strong> launches a new pod, which means that on any given time during an update the pod may not be running on a node.</p>

<p>It seems that DaemonSets are, compared to Deployments, the correct way to do that, but I couldn't find any way to prevent downtime when updating the DaemonSet. Is there any way to do this? I also thought of using Deployments and update a replica amount manuall and antiPodAffinity so only one pod gets deployed per node, but this is kind of hacky.</p>

<p>There was a very long set of discussions about adding this feature. You can see them <a href="https://github.com/kubernetes/kubernetes/issues/48841" rel="nofollow noreferrer">here</a> and <a href="https://github.com/kubernetes/enhancements/issues/373" rel="nofollow noreferrer">here</a></p>

<p>Long story short, this isn't really possible. You can try and combine <code>maxUnavailable: 0</code> and <code>type: rollingUpdate</code> in your <code>updateStrategy</code> but I don't think that's formally supported.</p>

<p>Example:</p>

<pre><code>apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: my-daemonset
  labels:
    service: my-daemonset
spec:
  selector:
    matchLabels:
      service: my-daemonset
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 0
  template:
    metadata:
      labels:
        service: my-daemonset
    spec:
      containers:
      - name: daemonset-update
        image: my-image:latest
</code></pre>
