<p>I would like to know if there is a way to force Kubernetes, during a deploy, to use every node in the cluster. 
The question is due some attempts that I have done where I noticed a situation like this:</p>

<ul>
<li><p>a cluster of 3 nodes</p></li>
<li><p>I update a deployment with a command like: <code>kubectl set image deployment/deployment_name my_repo:v2.1.2</code></p></li>
<li><p>Kubernetes updates the cluster</p></li>
</ul>

<p>At the end I execute <code>kubectl get pod</code> and I notice that 2 pods have been deployed in the same node. 
So after the update, the cluster has this configuration:</p>

<ul>
<li>one node with 2 pods</li>
<li>one node with 1 pod</li>
<li>one node without any pod (totally without any workload)</li>
</ul>

<p>The scheduler will try to figure out the most reasonable way of scheduling at given point in time, which can change later on and results in situations like you described. Two simple ways to manage this in one way or another are :</p>

<ul>
<li>use DaemonSet instead of Deployment : will make sure you have one and only one pod per node (matching nodeSelector / tolerations etc.)</li>
<li><p>use PodAntiAffinity : you can make sure that two pods of the same deployment in the same version are never deployed on the same node. This is what I personally prefer for many apps (unless I want more then one to be scheduled per node). Note that it will be in a bit of trouble if you decide to scale your deployment to more replicas then you have nodes.
Example for versioned PodAntiAffinity I use :</p>

<pre><code>metadata:
  labels:
    app: {{ template "fullname" . }}
    version: {{ .Values.image.tag }}
spec:
  affinity:
    podAntiAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchExpressions:
          - key: app
            operator: In
            values: ["{{ template "fullname" . }}"]
          - key: version
            operator: In
            values: ["{{ .Values.image.tag }}"]
        topologyKey: kubernetes.io/hostname
</code></pre></li>
<li><p>consider fiddling with <a href="https://github.com/kubernetes-incubator/descheduler" rel="nofollow noreferrer">Descheduler</a> which is like an evil twin of Kubes Scheduler component which will cause deleting of pods for them tu reschedule differently</p></li>
</ul>
