<p>So on GKE I have a Node.js <code>app</code> which for each pod uses about: <code>CPU(cores): 5m, MEMORY: 100Mi</code></p>

<p>However I am only able to deploy 1 pod of it per node. I am using the GKE <code>n1-standard-1</code> cluster which has <code>1 vCPU, 3.75 GB</code> per node.</p>

<p>So in order to get 2 pods of <code>app</code> up total = <code>CPU(cores): 10m, MEMORY: 200Mi</code>, it requires another entire +1 node = 2 nodes = <code>2 vCPU, 7.5 GB</code> to make it work. If I try to deploy those 2 pods on the same single node, I get <code>insufficient CPU</code> error.</p>

<p>I have a feeling I should actually be able to run a handful of pod replicas (like 3 replicas and more) on 1 node of <code>f1-micro</code> (1 vCPU, 0.6 GB) or <code>f1-small</code> (1 vCPU, 1.7 GB), and that I am way overprovisioned here, and wasting my money.</p>

<p>But I am not sure why I seem so restricted by <code>insufficient CPU</code>. Is there some config I need to change? Any guidance would be appreciated.</p>

<hr>

<pre><code>Allocatable:
 cpu:                940m
 ephemeral-storage:  47093746742
 hugepages-2Mi:      0
 memory:             2702216Ki
 pods:               110
Non-terminated Pods:         (7 in total)
  Namespace                  Name                                                CPU Requests  CPU Limits  Memory Requests  Memory Limits
  ---------                  ----                                                ------------  ----------  ---------------  -------------
  default                    mission-worker-5cf6654687-fwmk4                     100m (10%)    0 (0%)      0 (0%)           0 (0%)
  default                    mission-worker-5cf6654687-lnwkt                     100m (10%)    0 (0%)      0 (0%)           0 (0%)
  kube-system                fluentd-gcp-v3.1.1-5b6km                            100m (10%)    1 (106%)    200Mi (7%)       500Mi (18%)
  kube-system                kube-dns-76dbb796c5-jgljr                           260m (27%)    0 (0%)      110Mi (4%)       170Mi (6%)
  kube-system                kube-proxy-gke-test-cluster-pool-1-96c6d8b2-m15p    100m (10%)    0 (0%)      0 (0%)           0 (0%)
  kube-system                metadata-agent-nb4dp                                40m (4%)      0 (0%)      50Mi (1%)        0 (0%)
  kube-system                prometheus-to-sd-gwlkv                              1m (0%)       3m (0%)     20Mi (0%)        20Mi (0%)
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource  Requests     Limits
  --------  --------     ------
  cpu       701m (74%)   1003m (106%)
  memory    380Mi (14%)  690Mi (26%)
Events:     &lt;none&gt;
</code></pre>

<p>After the deployment, check the node capacities with <code>kubectl describe nodes</code>. For e.g: In the code example at the bottom of the answer:</p>

<p><strong>Allocatable cpu: 1800m</strong></p>

<p><strong>Already used by pods in kube-system namespace: 100m + 260m + +100m + 200m + 20m = 680m</strong></p>

<p><strong>Which means 1800m - 680m = 1120m is left for you to use</strong></p>

<p><strong>So, if your pod or pods request for more than 1120m cpu, they will not fit on this node</strong></p>

<blockquote>
  <p>So in order to get 2 pods of app up total = CPU(cores): 10m, MEMORY:
  200Mi, it requires another entire +1 node = 2 nodes = 2 vCPU, 7.5 GB
  to make it work. If I try to deploy those 2 pods on the same single
  node, I get insufficient CPU error.</p>
</blockquote>

<p>If you do the exercise described above, you will find your answer. In case, there is enough cpu for your pods to use and still you are getting insufficient CPU error, check if you are setting the cpu request and limit params correctly. See <a href="https://kubernetes.io/docs/tasks/configure-pod-container/assign-cpu-resource/#specify-a-cpu-request-and-a-cpu-limit" rel="nofollow noreferrer">here</a></p>

<p><strong>If you do all the above and still it's an issue. Then, I think in your case, what could be happening is that you are allocating 5-10m cpu for your node app which is too less cpu to allocate. Try increasing that may be to 50m cpu.</strong></p>

<blockquote>
  <p>I have a feeling I should actually be able to run a handful of pod
  replicas (like 3 replicas and more) on 1 node of f1-micro (1 vCPU, 0.6
  GB) or f1-small (1 vCPU, 1.7 GB), and that I am way overprovisioned
  here, and wasting my money.</p>
</blockquote>

<p>Again, do the exercise describe above to <em>conclude</em> that</p>

<pre><code>Name:            e2e-test-minion-group-4lw4
[ ... lines removed for clarity ...]
Capacity:
 cpu:                               2
 memory:                            7679792Ki
 pods:                              110
Allocatable:
 cpu:                               1800m
 memory:                            7474992Ki
 pods:                              110
[ ... lines removed for clarity ...]
Non-terminated Pods:        (5 in total)
  Namespace    Name                                  CPU Requests  CPU Limits  Memory Requests  Memory Limits
  ---------    ----                                  ------------  ----------  ---------------  -------------
  kube-system  fluentd-gcp-v1.38-28bv1               100m (5%)     0 (0%)      200Mi (2%)       200Mi (2%)
  kube-system  kube-dns-3297075139-61lj3             260m (13%)    0 (0%)      100Mi (1%)       170Mi (2%)
  kube-system  kube-proxy-e2e-test-...               100m (5%)     0 (0%)      0 (0%)           0 (0%)
  kube-system  monitoring-influxdb-grafana-v4-z1m12  200m (10%)    200m (10%)  600Mi (8%)       600Mi (8%)
  kube-system  node-problem-detector-v0.1-fj7m3      20m (1%)      200m (10%)  20Mi (0%)        100Mi (1%)
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  CPU Requests    CPU Limits    Memory Requests    Memory Limits
  ------------    ----------    ---------------    -------------
  680m (34%)      400m (20%)    920Mi (12%)        1070Mi (14%)
</code></pre>
