Create an ARM node pool and schedule workloads to ARM nodes

更新时间:
复制 MD 格式

If your cluster contains both ARM and x86 nodes, you can use native Kubernetes scheduling features to schedule ARM-only workloads to ARM nodes or to preferentially schedule multi-arch workloads to ARM nodes.

Prerequisites

Usage notes

If your ACK cluster contains both Arm and x86 nodes, add the kubernetes.io/arch=arm64:NoSchedule taint to your Arm nodes. This prevents applications and components that do not support the Arm architecture from being mistakenly scheduled to them. If your cluster runs a version earlier than Kubernetes v1.24, you must also declare a toleration for the kubernetes.io/arch=arm64:NoSchedule taint when you use nodeSelector or nodeAffinity to schedule applications to Arm nodes. To do this, add the corresponding tolerations key for the kubernetes.io/arch=arm64:NoSchedule taint. For clusters that run Kubernetes v1.24 or later, the scheduler automatically recognizes the kubernetes.io/arch=arm64:NoSchedule taint on Arm nodes, so a toleration is not required.

Billing

For more information about the ECS instance types that use the ARM architecture and their pricing, see the following topics:

Create an ARM cluster or node pool

You can add ARM nodes when you create a new ACK cluster, or add a new ARM node pool to an existing cluster.

During cluster creation

When you configure the node pool during cluster creation, in the Instance Type section, set Architecture to Arm. Then, select your instance types and configure other parameters to create the cluster. For more information about how to create a cluster, see Create an ACK managed cluster.

Note

In an existing cluster

When you create a node pool, in the Instance Type section, set Architecture to ARM. Then, select your instance types and configure other parameters to create the node pool. For more information about how to create a node pool, see Create and manage a node pool.

Note

Schedule ARM-only workloads to ARM nodes

If your cluster contains both ARM and x86 nodes, you must ensure that applications that support only the ARM architecture are scheduled to ARM nodes. This prevents their pods from failing to start on incompatible nodes. By default, all ARM nodes have the label kubernetes.io/arch=arm64. You can use nodeSelector or nodeAffinity to deploy applications to ARM nodes.

nodeSelector

Add the following nodeSelector to your pod's spec to schedule the pod to an ARM node. This schedules the workload only to nodes with the kubernetes.io/arch: arm64 label, which is present on all ARM nodes in an ACK cluster.

nodeSelector:
  kubernetes.io/arch: arm64 # Specify an ARM node.

You can use the following sample YAML to deploy a stateless application to an ARM node.

Example YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  name: only-arm
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx
    spec:
      nodeSelector:
        kubernetes.io/arch: arm64 # Specify an ARM node.
      containers:
      - name: nginx
        image: nginx

nodeAffinity

You can use node affinity to schedule pods to ARM nodes. The following rule schedules the pod only to nodes with the label kubernetes.io/arch=arm64.

When you use this affinity rule, the scheduler automatically adds a toleration for the kubernetes.io/arch=arm64:NoSchedule taint.

affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/arch
          operator: In
          values:
          - arm64

You can use the following sample YAML to deploy a stateless application to an ARM node.

Example YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  name: only-arm
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/arch
                operator: In
                values:
                - arm64
      containers:
      - name: nginx
        image: nginx

Schedule multi-arch workloads to ARM nodes

By default, ACK schedules all workloads to x86 nodes. If x86 nodes have insufficient resources, pods remain in a pending state instead of being scheduled to available ARM nodes. If your application uses a multi-arch image that supports both the x86 and ARM architectures, you should configure scheduling preferences to utilize nodes of different architectures.

For example, you can configure node affinity to prefer ARM or x86 nodes, and then fall back to nodes of the other architecture when the preferred nodes do not have enough resources.

      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            preference:
              matchExpressions:
              - key: kubernetes.io/arch
                operator: In
                values:
                - arm64

Prefer ARM nodes

Example YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  name: arm-prefer
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
# Preferentially schedule the workload to an ARM node.
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            preference:
              matchExpressions:
              - key: kubernetes.io/arch
                operator: In
                values:
                - arm64
      containers:
      - name: my-container
        image: nginx

Prefer x86 nodes

Example YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  name: amd-prefer
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
# Preferentially schedule the workload to an x86 node.
      affinity:
        nodeAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            preference:
              matchExpressions:
              - key: kubernetes.io/arch
                operator: In
                values:
                - amd64
      containers:
      - name: my-container
        image: nginx

FAQ

Can I use ARM-based preemptible instances?

ARM-based preemptible instances are available. For usage details, see Use preemptible instances.

Limitations of ARM nodes

Currently, only the following categories of Add-ons support the ARM architecture:

  • Core Components

  • Logs and Monitoring

  • Storage

  • Networking

Marketplace components do not support the ARM architecture.

References