<p>We have an Openshift environment on our company.<br>
We're trying to maximize the resources between our data scientists using jupyterhub.<br>
Is there an option for assigning more resources <strong>dynamicly</strong> per demand (if there are free resources avaliable). </p>

AS IL
<p>You can take a look at setting resource restrictions. (Quite counterintuitive, I agree).</p>

<p>In Kubernetes (and therefore in OpenShift) you can set resource <code>requests</code> and <code>limits</code>.</p>

<p>Resource <code>requests</code> are the minimum a pod is guaranteed from the scheduler on the node it runs on. Resource <code>Limits</code> on the other hand give you the capability to allow your pod to exceed its requested resources up to the specified limit. </p>

<p>What is the difference between not setting resource <code>requests</code> and <code>limits</code> vs setting them?</p>

<h3>Setting resource <code>requests</code> and <code>limits</code></h3>

<ul>
<li>scheduler is aware of resources utilized. New resources can be scheduled according to the resources they require.</li>
<li>scheduler can rebalance pods across the nodes if a node hits maximum resource utilization</li>
<li>pods can not exceed the <code>limits</code> specified</li>
<li>pods are guaranteed to get at least the resources specified in <code>requests</code></li>
</ul>

<h3><strong>NOT</strong> setting resource <code>requests</code> and <code>limits</code></h3>

<ul>
<li>scheduler is aware of resources utilized. New resources (e.g. pods) can be scheduled based on a best guess basis. It is not guaranteed that those new pods get minimum resources they require to run stable.</li>
<li>scheduler is not able to rebalance resources without at least <code>requests</code></li>
<li>pods can utilize memory / cpu without restrictions</li>
<li>pods are not guaranteed any memory / cpu time</li>
</ul>

<hr>

<h2>How to set up resource <code>requests</code> and <code>limits</code></h2>

<ul>
<li><a href="https://docs.openshift.com/container-platform/3.11/dev_guide/compute_resources.html" rel="nofollow noreferrer">https://docs.openshift.com/container-platform/3.11/dev_guide/compute_resources.html</a></li>
</ul>

<p>In the end it should look something like this</p>

<pre><code>apiVersion: v1
kind: Pod
spec:
  containers:
  - image: openshift/hello-openshift
    name: hello-openshift
    resources:
      requests:
        cpu: 100m 
        memory: 200Mi 
        ephemeral-storage: 1Gi 
      limits:
        cpu: 200m 
        memory: 400Mi 
        ephemeral-storage: 2Gi 
</code></pre>

<hr>

<p>Additional information can be found here</p>

<ul>
<li><a href="https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-resource-requests-and-limits" rel="nofollow noreferrer">https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-resource-requests-and-limits</a></li>
</ul>
