<p>I have an application running in multithreading and requires many cores on a SINGLE instance.
Just wondering how to merge multiple pod (ie containers) into a single big node, so the application can run on this big node.
For example: 64 pods into a single one (ie 64 cores).</p>
<p>This is not for production or HA service, just computation.
Application cannot be re-written.</p>
<p>Have <a href="https://stackoverflow.com/questions/20306628/how-to-make-all-distributed-nodes-ram-available-to-a-single-node">this reference</a>, a bit outdated.</p>

<p>First of all, running multiple pods on a single node couldn't be called &quot;merging&quot;, assigning or scheduling are better verbs I guess.</p>
<p>you just need to label your node, then schedule your pods to be spawned on nodes with that label:</p>
<ol>
<li><p>Run: <code>kubectl get nodes</code> , note the node name.</p>
</li>
<li><p><code>kubectl label nodes &lt;node-name&gt; bignode=yes</code></p>
</li>
<li><p>verify your node is labelled currectly:</p>
<p><code>kubectl get nodes --show-labels</code></p>
</li>
<li><p>then in your pod definition, define a node selector:</p>
</li>
</ol>
<pre><code>    apiVersion: v1
    kind: Pod
    metadata:
      name: nginx
      labels:
        env: test
    spec:
      containers:
      - name: nginx
        image: nginx
        imagePullPolicy: IfNotPresent
      nodeSelector:
        bignode: yes &lt;----------- 
</code></pre>
<p>More info in Kubernetes docs:
<a href="https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/</a></p>
<p>Update:
the other way is to set your CPU requests as high as you need,
so kubernetes will schedule your pods with sufficient CPU cores.</p>
<p>it could be like:</p>
<pre><code>    apiVersion: v1
    kind: Pod
    metadata:
      name: nginx
      labels:
        env: test
    spec:
      containers:
      - name: nginx
        image: nginx
        imagePullPolicy: IfNotPresent
    resources:
      requests:
        memory: &quot;2048Mi&quot;
        cpu: &quot;60&quot;
</code></pre>
<p>more info: <a href="https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/</a></p>
<p>if your concern is only number of cpu cores, second solution is more reliable,
if its important to have all pods on a single node, you can read about <a href="https://www.cncf.io/blog/2021/07/27/advanced-kubernetes-pod-to-node-scheduling/" rel="nofollow noreferrer">affinity</a> rules too.</p>
