<p>I have 3 nodes in k8s and i'm running kafka (3 cluster).
While deploying zk/broker/rest-proxy, its not getting deployed in all the available nodes. How can i make sure that all pods are deployed in different nodes. Do i need to use nodeaffinity or podaffinity ?</p>

<p>If you want all pods to run on different nodes - you must use <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#inter-pod-affinity-and-anti-affinity-beta-feature" rel="nofollow noreferrer">PodAntiAffinity</a>. If this is hard requirement - you must use <code>requiredDuringSchedulingIgnoredDuringExecution</code> rule. If it's not - use <code>preferredDuringSchedulingIgnoredDuringExecution</code>. </p>

<p><code>topologyKey</code> should be kubernetes.io/hostname. </p>

<p>In <code>labelSelector</code> put your pod's labels.</p>
