<p>We deploy JupyterHub to Kubernetes (specifically, AWS managed kubernetes “EKS”)
We deploy it via helm.
We run version 0.8.2 of JupyterHub.</p>

<p>We want to know:</p>

<p>(1) What is the default memory allocation for notebook servers?</p>

<p>(2) Is it possible to increase it? How?</p>

<p>For reference, this is our helm chart:</p>

<pre><code>auth:
  admin:
    access: true
    users:
      - REDACTED
  type: github
  github:
    clientId: "REDACTED"
    clientSecret: "REDACTED"
    callbackUrl: "REDACTED"
    org_whitelist:
      - "REDACTED"
  scopes:
    - read:org

singleuser:
  image:
    # Get the latest image tag at:
    # https://hub.docker.com/r/jupyter/datascience-notebook/tags/
    # Inspect the Dockerfile at:
    # https://github.com/jupyter/docker-stacks/tree/master/datascience-notebook/Dockerfile
    # name: jupyter/datascience-notebook
    # tag: 177037d09156
    name: REDACTED
    tag: REDACTED
    pullPolicy: Always
  storage:
    capacity: 32Gi

  lifecycleHooks:
    postStart:
      exec:
        command: ["/bin/sh", "-c", "touch ~/.env &amp;&amp; chmod 777 ~/.env"]

hub:
  # cookie_max_age_days - determines how long we keep the github
  # cookie in the hub server (in days).
  # cull_idle_servers time out - determines how long it takes before
  # we kick out an inactive user and shut down their user server.
  extraConfig: |
    import sys
    c.JupyterHub.cookie_max_age_days = 2
    c.JupyterHub.services = [
        {
            "name": "cull-idle",
            "admin": True,
            "command": [sys.executable, "/usr/local/bin/cull_idle_servers.py", "--timeout=3600"],
        }
    ]
</code></pre>

<p>The <a href="https://github.com/jupyterhub/zero-to-jupyterhub-k8s" rel="nofollow noreferrer">jupyterhub v0.8.2 charts</a> default memory resource request for each <code>singleuser</code> pod/container is <code>1G</code> in the <a href="https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/0.8.2/jupyterhub/values.yaml#L222-L224" rel="nofollow noreferrer">chart values</a>. Note that this is a <a href="https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#resource-types" rel="nofollow noreferrer">resource <code>request</code></a> which informs the kubernetes scheduler what the container should require on a node. The container is free to use up available memory on the node if needed. Kubernetes should only start evicting pods when the whole node is under memory pressure, which is basically less than 100MiB free memory total</p>

<p>To change this, override the <code>singleuser.memory.guarantee</code> value to set a different request (not sure why they changed the name).</p>

<pre><code>singleuser:
  memory:
    guarantee: '1024Mi'
</code></pre>

<p>The other option is to set a hard <code>limit</code> at which the container can be killed. There is no limit set by default in the helm <a href="https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/0.8.2/jupyterhub/values.yaml#L223" rel="nofollow noreferrer">chart default values</a>. To enforce a limit, override the <code>singleuser.memory.limit</code> value when running helm.</p>

<pre><code>singleuser:
  memory:
    limit: '1024Mi'
</code></pre>

<p>If you are looking at managing overall usage, you might want to look at <a href="https://kubernetes.io/docs/concepts/policy/resource-quotas/#enabling-resource-quota" rel="nofollow noreferrer">resource quotas</a> on the namespace you have jupyterhub running in as it looks like any of the above settings would be per user/singleuser instance. </p>
