<p>somebody could please help me to create a yaml config file for Kubernetes in order to face a situation like: one pod with 3 containers (for example) and these containers have to be deployed on 3 nodes of a cluster (Google GCE).</p>

<pre><code>|P|      |Cont1| ----&gt; |Node1|
|O| ---&gt; |Cont2| ----&gt; |Node2| &lt;----&gt; GCE cluster
|D|      |Cont3| ----&gt; |Node3|
</code></pre>

<p>Thanks</p>

<p>From <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/" rel="nofollow noreferrer">Kuberenets Concepts</a>,</p>

<blockquote>
  <p>Pods in a Kubernetes cluster can be used in two main ways: <strong>Pods that
  run a single container</strong>. The “one-container-per-Pod” model is the most
  common Kubernetes use case; in this case, you can think of a Pod as a
  wrapper around a single container, and Kubernetes manages the Pods
  rather than the containers directly. <strong>Pods that run multiple containers
  that need to work together</strong>. A Pod might encapsulate an application
  composed of multiple co-located containers that are tightly coupled
  and need to share resources. These co-located containers might form a
  single cohesive unit of service–one container serving files from a
  shared volume to the public, while a separate “sidecar” container
  refreshes or updates those files. The Pod wraps these containers and
  storage resources together as a single manageable entity.</p>
</blockquote>

<p>In short, most likely, you should place each container in a single Pod to truly benefit from the microservices architecture vs the monolithic architecture commonly deployed in VMs. However there are some cases where you want to consider co-locating containers. Namely, as described in this <a href="http://blog.kubernetes.io/2015/06/the-distributed-system-toolkit-patterns.html" rel="nofollow noreferrer">article (Patterns for Composite Containers)</a> some of the composite containers applications are:</p>

<ul>
<li>Sidecar containers</li>
</ul>

<blockquote>
  <p>extend and enhance the "main" container</p>
</blockquote>

<ul>
<li>Ambassador containers</li>
</ul>

<blockquote>
  <p>proxy a local connection to the world</p>
</blockquote>

<ul>
<li>Adapter containers</li>
</ul>

<blockquote>
  <p>standardize and normalize output</p>
</blockquote>

<p>Once you define and run the Deployments, the Scheduler will be responsible to select the most suitable placement for your Pods, unless you <a href="https://stackoverflow.com/a/42004597/1657309">manually assign Nodes</a> by defining Labels in Deployment's YAML (not recommended unless you know what you're doing).</p>
