<p>What would happen with kubernetes scheduling if I have a kubernetes node, but I use the container (docker) engine for some other stuff, outside of the context of kubernetes.</p>

<p>For example if I manually SSH to the respective node and I do <code>docker run</code> something. Would kubernetes scheduling take into account the fact that this node is busy running other stuff, and it might not be able to host any other containers now?</p>

<p>What would happen in the following scenario:</p>

<ul>
<li>Node with 8 GB RAM</li>
<li>running a pod with resource request 2 GB, limit 4 GB, and current usage 3 GB</li>
<li>ssh on node and <code>docker run</code> a container with 5 GB, using all</li>
</ul>

<p>P.S. Please skip the "why would you go and run <code>docker run</code> directly on the node" questions. I don't want to, but reasons.</p>

LIvanov
<p>I'm pretty sure Kubernetes's scheduling only considers (a) pods it knows about and not other resources, and (b) only their resource requests.</p>

<p>In the situation you describe, with exactly that resource utilization, things will work fine.  The pod can be scheduled on the node because the total resource requests using it are 2 GB out of 8 GB.  The total memory usage doesn't exceed the physical memory size either, so you're okay.</p>

<p>Say the pod allocated a little bit more memory.  Now the system as a whole is above its physical memory capacity, so the Linux kernel will arbitrarily kill something off.  This is often the largest thing.  You'll typically see an exit code of 137 (matching SIGKILL) in whichever system manages it.</p>

<p>This behavior is the same even if you run your side job in something like a DaemonSet.  It requests 2 GB of RAM, so both pods fit on the same node [4 GB/8 GB], but if it has a resource limit of 6 GB RAM, something will get killed off.</p>

<p>The place where things are different is if you can predict the high memory use.  Say your pod requests 3 GB/limits 6 GB of RAM, and your side process will predictably also use 6 GB.  If you just <code>docker run</code> it something will definitely get OOM-killed.  If you run it as a DaemonSet declaring a 6 GB memory request, the Kubernetes scheduler will know the pod doesn't fit and won't place it there (it may get stuck in "Pending" state if it can't be scheduled anywhere).</p>
