All Products
Search
Document Center

Container Service for Kubernetes:Schedule workloads to ARM-based nodes

Last Updated:Sep 07, 2024

By default, Container Service for Kubernetes (ACK) schedules all workloads to x86-based worker nodes. If your cluster contains ARM-based nodes and other nodes, such as x86-based nodes, you can configure Kubernetes scheduling to schedule ARM workloads only to ARM-based nodes or preferably schedule multi-arch workloads to ARM-based nodes.

Prerequisites

  • An ACK cluster with ARM-based nodes or an ARM-based node pool is created and the Kubernetes version of the cluster meets the requirement. For more information, see Configure an ARM-based node pool.

    ARM-based instances are available only in specific regions and zones. Make sure that the ACK cluster is deployed in a region that supports ARM-based instances. For more information about the regions and zones where ARM-based instances are available, see Instance Types Available for Each Region.

  • The kube-scheduler component is installed. For more information, see kube-scheduler.

Usage notes

If both ARM-based nodes and x86-based nodes exist in your cluster, we recommend that you add the kubernetes.io/arch=arm64:NoSchedule taint to ARM-based nodes. This avoids accidentally scheduling applications or components that do not support the ARM architecture to ARM-based nodes. When you configure nodeSelector or nodeAffinity to schedule applications to ARM-based nodes in an ACK cluster that runs a Kubernetes version earlier than 1.24, you need to add a toleration to tolerate the kubernetes.io/arch=arm64:NoSchedule taint. However, if the cluster runs Kubernetes 1.24 or later, the scheduler automatically tolerates the kubernetes.io/arch=arm64:NoSchedule taint. In this case, you do not need to add a toleration to tolerate the taint.

Billing

Pods deployed on elastic container instances that adopt the ARM architecture are billed based on the ECS instance type used to create the elastic container instances. The pods are not billed based on the usage of vCPUs and memory.

Important

After an Elastic Container Instance-based pod is created, you can run the kubectl describe pod command to view the YAML content of the pod. The k8s.aliyun.com/eci-instance-spec parameter indicates the ECS instance type used by the pod. The pod is billed based on the ECS instance type.

For more information about the ECS instance types that use the ARM architecture, refer to the following topics:

Schedule ARM workloads to ARM-based nodes

If your cluster contains ARM-based nodes and other nodes and all workloads use the ARM architecture, you need to schedule the workloads only to ARM-based nodes. If pods are scheduled to other nodes, the pods cannot launch. By default, all ARM-based nodes have the kubernetes.io/arch=arm64 label. You can use the nodeSelector or nodeAffinity setting to schedule workloads to ARM-based nodes.

Use the nodeSelector

Add the following constraint to pods. This way, the nodeSelector schedules pods to ARM-based nodes. The nodeSelector schedules the pods of the workload only to nodes that have the arm64 label. All ARM-based nodes in the cluster have this label.

nodeSelector:
  kubernetes.io/arch: arm64 # Specify the label that is used to select an ARM-based node.

You can use the following YAML file to deploy a stateless application on an ARM-based node.

Show YAML content

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 the label that is used to select an ARM-based node. 
      containers:
      - name: nginx
        image: nginx

Use nodeAffinity

You can add the following constraint to a pod to schedule the pod to an ARM-based node based on node affinity. After this constraint is added, the pod can be scheduled only to a node that has the kubernetes.io/arm=arm64 label.

When the pod spec contains this constraint, the scheduler tolerates 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 YAML file to deploy a stateless application on an ARM-based node.

Show YAML content

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-based nodes

By default, ACK schedules all workloads to x86-based nodes. Pods become pending when x86 nodes are insufficient. If your application image is a multi-arch image, such as an image that supports the x86 and ARM architectures, you need to configure cross-architecture node scheduling.

For example, you can configure node affinity to preferably schedule workloads to ARM-based or x86-based nodes. Then, schedule workloads to other types of nodes when ARM-based or x86-based nodes are insufficient.

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

Preferably schedule workloads to ARM-based nodes

The following workload is preferably scheduled to ARM-based nodes.

Show YAML content

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

Preferably schedule workloads to x86-based nodes

The following workload is preferably scheduled to x86-based nodes.

Show YAML content

apiVersion: apps/v1
kind: Deployment
metadata:
  name: amd-prefer
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      tolerations:
# Preferably schedule the workload to a x86-based 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 more information, see Use preemptible instances.

What are the limits on using ARM-based nodes in ACK clusters?

Only the following components support the ARM architecture:

  • Key components

  • Logging and monitoring components

  • Volume components

  • Network components

Components that are displayed on the Marketplace page of the ACK console do not support the ARM architecture.

References