Configure Node Resource Reservation

Use a KubeletConfig object to reserve CPU, memory, and ephemeral storage for the operating system and Kubernetes components. Machine Configuration applies the reservation to nodes that run Alauda OS.

Supported Fields

FieldPurpose
systemReservedResources reserved for operating system daemons
kubeReservedResources reserved for Kubernetes components
evictionHardHard eviction thresholds

This API does not manage other kubelet settings.

Use Automatic Reservation

Machine Configuration creates acp-default-node-reservation on supported clusters. It calculates systemReserved on each node. Do not set systemReserved in an automatic reservation object.

apiVersion: machineconfiguration.alauda.io/v1alpha1
kind: KubeletConfig
metadata:
  name: acp-default-node-reservation
spec:
  autoSizingReserved: true
  machineConfigPoolSelector:
    matchLabels:
      machineconfiguration.alauda.io/node-reservation: 'true'

The default control plane and worker pools have the machineconfiguration.alauda.io/node-reservation=true label.

kubectl get kubeletconfig acp-default-node-reservation
kubectl get machineconfigpool -L machineconfiguration.alauda.io/node-reservation

Set Static Reservation Values

Use static mode when every selected node must use the same values.

  1. Create the target worker pool and assign nodes to it. See Managing Node Configuration. This example uses a pool named worker-static.

  2. Label the pool:

    kubectl label machineconfigpool worker-static reservation=static
  3. Apply a static KubeletConfig:

    apiVersion: machineconfiguration.alauda.io/v1alpha1
    kind: KubeletConfig
    metadata:
      name: worker-static-reservation
    spec:
      autoSizingReserved: false
      machineConfigPoolSelector:
        matchLabels:
          reservation: static
      kubeletConfig:
        systemReserved:
          cpu: 500m
          memory: 1Gi
        kubeReserved:
          memory: 1Gi
        evictionHard:
          memory.available: 100Mi
    kubectl apply -f worker-static-reservation.yaml

Static mode uses only the values in spec.kubeletConfig.

Verify the Reservation

  1. Check the reservation object:

    kubectl get kubeletconfig acp-default-node-reservation -o yaml

    For static mode, replace the name with worker-static-reservation.

  2. Check the node state:

    kubectl get node -o custom-columns=NODE:.metadata.name,CURRENT:.metadata.annotations."machineconfiguration\.alauda\.io/currentConfig",DESIRED:.metadata.annotations."machineconfiguration\.alauda\.io/desiredConfig",STATE:.metadata.annotations."machineconfiguration\.alauda\.io/state"

    STATE should be Done, and CURRENT should match DESIRED.

  3. On a target node, check the kubelet arguments:

    ps -ef | grep kubelet | grep system-reserved

    For automatic mode, also check the calculated result:

    grep ACP_KUBELET_RESERVATION_ARGS /etc/systemd/node-sizing.env

    The result should include --system-reserved. If the file contains only ACP_KUBELET_STATIC_ARGS, the calculation has not finished.

A successful update restarts kubelet. It does not plan a node reboot.

Limitations

  • The feature applies only to supported clusters that run Alauda OS and Machine Configuration.
  • Automatic mode calculates systemReserved only.
  • A node pool can match only one KubeletConfig.