diff --git a/configs/capi/lab1.yaml b/configs/capi/lab1.yaml index 9f0af82..819b81e 100644 --- a/configs/capi/lab1.yaml +++ b/configs/capi/lab1.yaml @@ -15,6 +15,7 @@ # 4. `vlan: 4` on net0 of both ProxmoxMachineTemplates # 5. lab1-worker: 1 socket x 4 cores, 4096 MiB (owner's choice; runbook said 8192) # 6. MachineDeployment lab1-workers: `replicas` removed (the autoscaler owns it) +# 7. MachineDeployment lab1-workers: autoscaler min/max + capacity annotations (runbook Step 5) apiVersion: cluster.x-k8s.io/v1beta2 kind: Cluster metadata: @@ -223,6 +224,14 @@ spec: apiVersion: cluster.x-k8s.io/v1beta2 kind: MachineDeployment metadata: + annotations: + cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: "0" + cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size: "5" + # scale-from-zero: CAPMOX publishes no status.capacity; must match ProxmoxMachineTemplate/lab1-worker + capacity.cluster-autoscaler.kubernetes.io/cpu: "4" # numSockets 1 × numCores 4 + capacity.cluster-autoscaler.kubernetes.io/memory: "4Gi" # memoryMiB 4096 + capacity.cluster-autoscaler.kubernetes.io/ephemeral-disk: "40Gi" # bootVolume sizeGb 40 + capacity.cluster-autoscaler.kubernetes.io/maximum-pods: "110" labels: cluster.x-k8s.io/cluster-name: lab1 name: lab1-workers diff --git a/docs/phase-1-proxmox-capi.md b/docs/phase-1-proxmox-capi.md index 41cb994..db86698 100644 --- a/docs/phase-1-proxmox-capi.md +++ b/docs/phase-1-proxmox-capi.md @@ -159,9 +159,20 @@ metadata: capacity.cluster-autoscaler.kubernetes.io/maximum-pods: "110" ``` +They are part of `MachineDeployment/lab1-workers` in [configs/capi/lab1.yaml](../configs/capi/lab1.yaml); +re-apply the file (the only diff is these annotations; `replicas` isn't in the manifest, so it +stays as is): + +```bash +export KUBECONFIG=~/.kube/lab-mgmt.kubeconfig +kubectl diff -f configs/capi/lab1.yaml # expect only the six annotations on lab1-workers +kubectl apply -f configs/capi/lab1.yaml +``` + Capacity annotations are required for scale-from-zero because CAPMOX does not publish `status.capacity`. They must match the `ProxmoxMachineTemplate`; add `.../labels` and `.../taints` -annotations if pods target the group by selector/toleration. +annotations if pods target the group by selector/toleration. They have no effect until +cluster-autoscaler runs (Step 6). ## Step 6 — cluster-autoscaler