kubespawner icon indicating copy to clipboard operation
kubespawner copied to clipboard

Singleuser Pod level reource allocation

Open Dinesh-4320 opened this issue 9 months ago • 2 comments

Proposed change

Kubernetes v1.32 had delivered an enhancement of specifying resource requests and limits at the Pod level. There had always been a fear in jupyterhub when any extraContainers used in singleuser pod without specifying the resource requests and limits may continue to use resources unconditionally. Such condition should be controlled at pod level. It can achieved by giving kubespawner ability to create singleuser-pod with pod level resource constraints.

Alternative options

We can also be able to specifiy these resource allocation under extra_pod_config, but having separate variables for it would be a good option.

Who would use this feature?

  • I had seen some companies use extra containers in their single user pod for various purposes along with jupyter notebook in jupyterhub. Also the workloads are mostly deployed under kubernetes clusters of various cloud providers like AWS.
  • This feature help them to specify the resource constraints at a single place for entire pod, without worrying about resources required for each container.
  • Also accuracy on pre-calculating node resource requirements will be additional advantage while having this feauture.

Suggested solution

  • These variables below are used to allocate resources for notebook container in singleuser-pod. Instead these variables has to be used to specify the resource requirements for entire pod.

    cpu_limit=
    cpu_guarantee=
    mem_limit=
    mem_guarantee=
    extra_resource_limits=
    extra_resource_guarantees=
    
  • For notebook we can add separate variables as given below.

    nb_cpu_limit=
    nb_cpu_guarantee=
    nb_mem_limit=
    nb_mem_guarantee=
    nb_extra_resource_limits=
    nb_extra_resource_guarantees=
    

Dinesh-4320 avatar Feb 25 '25 14:02 Dinesh-4320

Please solve this issue

mageshkrishna avatar Apr 02 '25 14:04 mageshkrishna

If you're running multiple containers in JupyterHub you're already using a fairly advanced low-level configuration since extra_containers requires writing something close to raw Kubernetes manifests, and extra_pod_config avoids adding more complexity to KubeSpawner.

manics avatar Apr 02 '25 21:04 manics