Group CRD Reference
The Group Custom Resource Definition (CRD) defines autoscaling policies for collections of physical nodes.
API Version
- Group:
infra.homecluster.dev - Version:
v2alpha1(served and storage;v1alpha1is removed in this release) - Kind:
Group
Specification
GroupSpec
| Field | Type | Required | Description |
|---|---|---|---|
scaleDownUtilizationThreshold | string | Yes | CPU utilization threshold for scale-down, a decimal string ("0.5") |
scaleDownGpuUtilizationThreshold | string | Yes | GPU utilization threshold for scale-down, a decimal string ("0.5") |
scaleDownUnneededTime | *metav1.Duration | Yes | Time a node must be unneeded before scale-down |
scaleDownUnreadyTime | *metav1.Duration | Yes | Time an unready node waits before scale-down |
maxNodeProvisionTime | *metav1.Duration | Yes | Maximum time to wait for node provisioning. Reported to cluster-autoscaler as its own scale-up termination deadline (GetOptions → MaxNodeProvisionDuration), and the floor of a claim's spec.deadlineAt: a claim never dies while the autoscaler is still waiting for it |
zeroOrMaxNodeScaling | bool | Yes | Whether to scale to zero or max nodes only |
ignoreDaemonSetsUtilization | bool | Yes | Ignore DaemonSet pods in utilization calculations |
minSize | int32 | No | Floor cluster-autoscaler must not scale the group below. Defaults to 0 |
nodeReadinessTaints | []corev1.Taint | No | Taints a machine of this group must be free of before the controller calls the slot ready and uncordons it, on top of the node reporting Ready. Defaults to Cilium's node.cilium.io/agent-not-ready (NoExecute); an empty list gates on Ready alone |
Readiness Gate
nodeReadinessTaints is the list the gate for a claim's ready phase waits for: the
JobCompleted → Ready transition of the scale-up, which is the only writer of
NodeClaim.status.phase: ready. The kubelet marks a node Ready long before the CNI has programmed its datapath, and the
pool's workloads do not tolerate the bootstrap taint the CNI stamps while it works, so a slot declared
ready in that window is read by cluster-autoscaler as capacity its pending pod cannot land on - and
the pool buys a second machine for a node that is about to work. The controller holds the scale-up
open until the taint is gone, so pool workloads need no toleration for it.
- The key is what the gate matches; Kubernetes keeps one taint per key on a node object, so a
declaration's
valueandeffectare documentation and are not compared. - The CRD defaults the list to Cilium's key (Cilium has stamped
node.cilium.io/agent-not-readysince v1.9; the pool this chart deploys runs 1.16.x). A Group written before the field existed gets the gate it was already getting. nodeReadinessTaints: []turns the gate off: a pool on a CNI that stamps no bootstrap taint gates onReadyalone.- These are the taints the gate reads. The taints to stamp on the machine are
spec.nodeTaintsof the Node CR, and a key must not be in both: the gate's key is stamped and removed by its owner, so a declaration that stamps it makes the slot's own scale-up wait for a taint the slot keeps putting back.taints.IsProtectedKeyrefuses Cilium's key innodeTaints. - The gate is bounded: 90s for the node object to register, then 4m for readiness, counted from the
moment the object appears. A timeout uncordons the node, records a
ReadinessGateTimeoutWarning on the slot, and fails the claim with that reason, because a cordoned node is skipped by cluster-autoscaler's scale-down - never drained, never deleted, and paid for forever. The input law then powers the machine off, the slot becomes free, and the next claim on it is attempt N+1. Underv1alpha1a timed-out gate completed the transition and recorded the slotready; the claim model refuses to call capacity that cannot take the pool's work ready.
spec:
# The pool boots on a CNI that stamps its own startup taint.
nodeReadinessTaints:
- key: node.cilium.io/agent-not-ready
effect: NoExecute
---
spec:
# flannel / a cloud CNI: no bootstrap taint, so no gate beyond Ready.
nodeReadinessTaints: []
The keys a slot is gated on are recorded on the slot as the NodeReadinessTaints condition, so a slot
that has been booting for ten minutes says what it is waiting for. See
State Management.
Example
apiVersion: infra.homecluster.dev/v2alpha1
kind: Group
metadata:
name: worker-nodes
namespace: homelab-autoscaler-system
spec:
# Keep one node of the pool up; omit for a group that may scale to nothing.
minSize: 1
scaleDownUtilizationThreshold: "0.5"
scaleDownGpuUtilizationThreshold: "0.5"
scaleDownUnneededTime: "10m"
scaleDownUnreadyTime: "20m"
maxNodeProvisionTime: "15m"
zeroOrMaxNodeScaling: false
ignoreDaemonSetsUtilization: true
Usage
Creating a Group
- Set scaling thresholds for CPU and GPU utilization
- Configure timing parameters for scale-down behavior
- Apply the Group resource to your cluster
The size of a group is not part of the spec beyond minSize: its max size is the number
of Node CRs labelled group: <group name>, so a pool grows and shrinks by committing
slots, not by editing the Group.
kubectl apply -f group.yaml
Monitoring Group Status
# Check group status
kubectl get groups -n homelab-autoscaler-system
# Get detailed group information
kubectl describe group worker-nodes -n homelab-autoscaler-system
# Watch group status changes
kubectl get groups -n homelab-autoscaler-system -w
Scaling Behavior
Scale-Up Triggers
- Pod scheduling failures due to insufficient resources
- CPU/memory pressure on existing nodes
- External scaling requests via gRPC API
Scale-Down Triggers
- Node utilization below
scaleDownUtilizationThreshold - GPU utilization below
scaleDownGpuUtilizationThreshold - Node unneeded for longer than
scaleDownUnneededTime - Node unready for longer than
scaleDownUnreadyTime
Minimum Size
minSize is the floor of the group. The gRPC cloud provider reports it to
cluster-autoscaler as the min size of the node group, and refuses its own scale-down
entry points (NodeGroupDeleteNodes, NodeGroupDecreaseTargetSize) when the request
would take the group below it, so a pool that has to keep a machine up sets minSize: 1
and the autoscaler stops reclaiming that node. A pool that used a keepalive pod to pin an
always-on slot above the utilization threshold can drop the pod once the group declares
the floor.
Two things to know:
0is the default and matches the behaviour of every release before the field existed: the group may scale down to nothing.maxSizeis not a field. The provider derives it by counting the Node CRs labelledgroup: <group name>. The CRD therefore cannot assertminSize <= maxSize; the gRPC boundary does, clamping aminSizeabove the number of slots to that count and refusing a scale up that would exceed it.
minSize: 0 is a supported floor, and a pool that uses it answers one more question: with no slot
registered, cluster-autoscaler sizes the group's node template from
spec.nodeCapacity on the Node CRs. A pool at zero that declares nothing
has a template with no cpu and no memory, no pod with requests fits it, and NodeGroupIncreaseSize
is never called, so the group stays at zero and the floor that works is minSize: 1.
Timing Parameters
| Parameter | Purpose | Typical Value |
|---|---|---|
scaleDownUnneededTime | Prevents flapping by requiring sustained low utilization | 10m |
scaleDownUnreadyTime | Removes unresponsive nodes | 20m |
maxNodeProvisionTime | Timeout for node startup operations | 15m |
Best Practices
Resource Planning
- Account for startup time in
maxNodeProvisionTime
Threshold Tuning
- Start with conservative thresholds (0.5-0.7) and adjust based on workload patterns
- Monitor actual utilization patterns before optimizing thresholds
- Consider workload characteristics (CPU vs memory intensive)
Troubleshooting
Common Issues
-
Nodes not joining the group
- Check that the
grouplabel is set on the Node CRs: the group's slots are exactly the Node CRs labelledgroup: <name>, and that count is the group'smaxSize
- Check that the
-
Scaling not working
- Verify gRPC server is running and accessible
- Check controller logs for errors
- The group's requests are objects:
kubectl get nodeclaim -n homelab-autoscaler-system -l group=<group>—pendingmeans the provider answered the autoscaler and nothing has started, afailedclaim says why instatus.reason
-
The pool grows past its floor, or refuses to shrink
spec.minSizeis enforced by the provider atDeleteNodesandDecreaseTargetSize, judged against the target size the request can actually produce (the count of live claims)
Debugging Commands
# Check group controller logs
kubectl logs -n homelab-autoscaler-system deployment/homelab-autoscaler-controller-manager
# List nodes in group
kubectl get nodes -l group=worker-nodes
# Check node CRDs
kubectl get nodes.infra.homecluster.dev -l group=worker-nodes
# Check the requests of the group, and the budget they carry
kubectl get nodeclaim -n homelab-autoscaler-system -l group=worker-nodes -o wide
# Verify gRPC server status
kubectl port-forward -n homelab-autoscaler-system service/homelab-autoscaler-grpc 50051:50051
Related Documentation
- Node CRD - Individual node management
- NodeClaim CRD - the requests the pool's capacity is made of, and where
maxNodeProvisionTimelands:spec.deadlineAt, floored by this field - Architecture Overview - System design