NavigationContentFooter
Jump toSuggest an edit

How to deploy both x86 and ARM images in Kubernetes

Reviewed on 02 September 2024Published on 29 February 2024

In a multi-architecture computing environment, where both x86 and ARM architectures are used, deploying applications in a Kubernetes cluster can present challenges. However, Kubernetes provides several mechanisms to manage architectural diversity effectively. Two of the most common approaches are using multi-arch images and architecture-specific deployments.

What is ARM architecture, and why is it different from x86?

  • ARM architecture is commonly used in devices like Raspberry Pi, IoT devices, and recent Cost-Optimized Instances based on ARM.
  • Kubernetes clusters may consist of nodes with different architectures, including x86 and ARM.
  • Deploying applications across these diverse architectures requires special consideration.

For a detailed comparison between ARM and x86 architectures, refer to our dedicated documentation Understanding the differences between ARM and x86 Instances.

Using multi-arch images

The most common approach to using ARM and x86 architecture Instances in a Kubernetes cluster is multi-arch images. These images contain binaries for multiple architectures, allowing Kubernetes to pull the appropriate binaries for each node.

How to deploy multi-arch images

  1. Build multi-arch images. Docker supports multi-arch builds using buildx.
  2. Push the built images to a container registry accessible by your Kubernetes cluster. For example, you can use the Scaleway Container Registry.
  3. Specify node selectors and affinity. Use either node selectors and affinity rules to ensure pods are scheduled on nodes with compatible architectures.
    Tip

    Alternatively, use taints to mark nodes with specific architectures and tolerations to allow pods to run on those nodes. Refer to the official Kubernetes documentation for more information regarding taints and tolerations.

Example

Below, you can find an example of a pod configuration with affinity set to target the kubernetes.io/arch=arm64 label, which is present by default on Scaleway ARM nodes:

apiVersion: v1
kind: Pod
metadata:
name: example-pod-with-affinity
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- arm64
containers:
- name: my-container
image: my-image:latest
# Add more container configurations as needed

In this example, the pod’s affinity is configured to be scheduled on nodes that have the label kubernetes.io/arch with the value arm64. This ensures that the pod will only be scheduled on nodes with this architecture.

Note

Using multi-arch images you benefit from a

  • simplified deployment process.
  • scalable solution for managing multi-architecture clusters.

Using architecture-specific deployments

You can also use architecture-specific deployments as an alternative, if multi-arch images are not available.

How to deploy architecture-specific images

  1. Start by determining the architecture of each node in the Kubernetes cluster.
  2. Build architecture-specific images by creating separate images for each architecture (x86 and ARM).
  3. Assign labels to images with the corresponding architecture name.
  4. Deploy with architecture-specific manifests for each architecture.
Note

Keep in mind that,

  • there is an increased management overhead due to maintaining separate images and manifests.
  • this approach is mostly suitable for scenarios where multi-arch images are not suitable.
See also
How to use the scratch storage on H100 GPU Instances with KapsuleHow to enable or disable SSH
Was this page helpful?
API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2024 – Scaleway