What is allocatable in vCluster virtual scheduler
What are allocatable resources on a node?​
Allocatable on a Kubernetes node represents the compute resources available for pods. The scheduler prevents over-subscribing resources beyond the allocatable value. It supports three primary resource types:
- CPU
- Memory
- Ephemeral storage
What is vCluster virtual scheduler?​
By default, vCluster uses the host cluster scheduler to determine pod placement. This approach offers two key benefits:
- Saves computing resources.
- Allows pods to run on any node.
However, the host cluster scheduler has limitations detailed in the virtual scheduler documentation. The virtual scheduler provides an alternative by:
- Making independent pod allocation decisions.
- Allowing taints and labels on virtual cluster nodes.
- Preventing modifications to the host cluster nodes.
The challenge with allocatable values​
When using the vCluster virtual scheduler, you'll notice a significant difference between node allocatable values in the host cluster and vCluster context.
Consider this scenario:
- Kubernetes cluster with three nodes
- vCluster assigned to use only two nodes
- Focus on CPU allocation for simplicity
Host cluster perspective​
In the host Kubernetes cluster context, the first node shows 62.5 allocatable CPUs. This value is calculated by:
- Total node CPUs: 64
- Minus
kubeReserved
andsystemReserved
values
vCluster perspective​
In the vCluster context, the same node shows an allocatable value of 30.5 or lower.
Why the allocatable values differ​
The vCluster scheduler uses the allocatable value to prevent over-subscribing resources.
- Must reflect resources available specifically to vCluster
- Cannot use the entire host cluster's allocatable value
- Node details show only what vCluster knows and controls
Using the full allocatable value of the host cluster would cause the vCluster scheduler to over-subscribe the node.
How vCluster manages allocatable values​
The vCluster syncer implements a dynamic update mechanism:
- Regularly reads node information from the host cluster.
- Updates node information in the vCluster.
- Ensures allocatable values change as pods start and stop in the host context.