Upgrade to Pro — share decks privately, control downloads, hide ads and more …

実践ARMアーキテクチャ移行 

 実践ARMアーキテクチャ移行 

https://techramenconf.net/
Technology Roundtable on the future of Asahikawa for Makers and ENgineers.
上記イベントでお話しました。

Kazuhiko Yamashita

July 26, 2024
Tweet

More Decks by Kazuhiko Yamashita

Other Decks in Technology

Transcript

  1. ಛ௃ ARM x86 ໋ྩηοτ RISC CISC ΤωϧΪʔޮ཰ লΤωϧΪʔͰ௿ిྗফඅ Ұൠతʹߴ͍ফඅిྗ ίετ

    Ұൠతʹ͸੡଄ίετ͕௿͘ɺ
 େن໛ಋೖʹద͍ͯ͠Δ ߴՁͰ͋Δ͜ͱ͕ଟ͍ ύϑΥʔϚϯε Ұൠతʹੑೳ͕௿͍৔߹͕͋Δ ͕ɺ࠷ۙͷGravitonͳͲߴੑೳԽ ߴੑೳͰɺ
 ಛʹߴෛՙλεΫʹڧ͍ ιϑτ΢ΣΞޓ׵ੑ Ұ෦ͷݹ͍x86ΞϓϦέʔγϣϯ ͱͷޓ׵ੑ͕௿͍ ෯޿͍ιϑτ΢ΣΞޓ׵ੑ͕͋Γɺ ݹ͍ΞϓϦέʔγϣϯ΋αϙʔτ ΤίγεςϜ ϞόΠϧσόΠεͰ޿͘࢖༻͞ Εɺٕज़తʹ੒ख़͍ͯ͠Δ σεΫτοϓ΍αʔόʔͰ޿͘࢖ ༻͞Εɺ੒ख़ͨ͠ΤίγεςϜ ARM vs x86
  2. ϚϧνΫϥελʔߏ੒ x86ͱARM͕ࠞࡏ͢ΔͨΊɺ
 ϚϧνΞʔΩςΫνϟΠϝʔδ͕ඞཁ NKE App App App App x86ߏ੒ EKS

    App App App x86/ARMࠞࡏߏ੒ App ΦϯϓϨϛεDC AWS ͍͕҆ɺ୹࣌ؒͰ͸༗ݶεέʔϧ ΦϯϓϨϛεͷϦιʔε͕଍Γͳ͍৔߹΍ ো֐࣌ʹ׆༻ɻฏ࣌͸লྗঢ়ଶ
  3. Docker͸ϓϥοτϑΥʔϜͷࢦఆ͕Ͱ͖Δ $ docker build —platform linux/arm64 . x86 architecture node

    emurator(qemu) Docker ΤϛϡϨʔλʔʹΑΓɺҟͳΔϓϥοτϑΥʔϜͷΠϝʔδ΋࡞੒Մೳ
  4. ޻෉͕ඞཁͳՕॴ ARG TARGETARCH RUN curl -sL "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/

    $TARGETARCH/kubectl" \ -o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl Dockerͷఏڙ͢ΔϏϧυҾ਺Λར༻ͯ͠ɺΞʔΩςΫνϟ͝ͱͷ
 ॲཧΛ࣮૷ͨ͠Γ͢Δඞཁ͕͋Δ
  5. ޻෉͕ඞཁͳՕॴ ARG TARGETARCH RUN if [ "${TARGETARCH}" = "amd64" ];

    then \ ARCH='x86-64'; \ ARCH_SAM='x86_64'; \ elif [ "${TARGETARCH}" = "arm64" ]; then \ ARCH='aarch64'; \ ARCH_SAM='arm64'; \ else \ echo "Unsupported arch: ${TARGETARCH}"; exit 1; \ f ྺ࢙΍࣮૷ࠩҟ͸༷ʑ͋Δɾɾɾ͋Δͷͩ
  6. ϚϧνΞʔΩςΫνϟΠϝʔδͷ࡞੒ $ docker buildx imagetools create -t example:latest example:amd64 example:arm64

    example:amd64 example:arm64 example:latest ΠϝʔδΛϨδετϦʹϓογϡ͓͍ͯͯ͠ɺ1ίϚϯυͰOK
  7. [࠶ܝ]Docker͸ϓϥοτϑΥʔϜͷࢦఆ͕Ͱ͖Δ $ docker build —platform linux/arm64 . x86 architecture node

    emurator(qemu) Docker ҟͳΔϓϥοτϑΥʔϜΛѻ͏৔߹ɺΤϛϡϨʔλʔͷΦʔόʔϔου͕͋ΔͨΊɺ
 ࣮ߦ͕஗͘ͳΔͷͰx86ɺARMͦΕͧΕͷ؀ڥΛ੔උ
  8. Actions Tips jobs: build_images: strategy: matrix: runner: [x86-builder, arm-builder] runs-on:

    ${{ matrix.runner }} buildλεΫͳͲ͸matrixΛ࢖͏ͱDRYʹॻ͚Δ build_images arm build_images x86 build_images
  9. Deb and RPM packages are dif fi cult for me.

    • CͷΫϩείϯύΠϧ͸ґଘ΋ؚΊͯ΍Ζ͏ͱࢥ͏ͱ݁ߏ͠ΜͲ͍ • Deb/RPMύοέʔδͦΕͧΕه๏΍࣮ߦํ๏͕ҟͳΔͨΊɺ৭ʑͱ
 ௐ΂Δ͜ͱ͕ଟ͍ • ݱ୅ͳΒDockerͰx86/ARMΛΤϛϡϨʔγϣϯͯ͠ɺϗετίϯύΠϧ
 ͢Δͷ͕͓͢͢Ί(ͨͩ͠ɺΊͪΌͪ͘Ό஗͍)
  10. ࢀߟʹͨ͠WEBαΠτ • Opt Technologies Magazine - Πϯϑϥʹ͓͚ΔCPUΞʔΩςΫνϟʹର ͢Δߟ࡯(https://tech-magazine.opt.ne.jp/entry/2022/06/03/190016) • NEXXWAVE

    - Benchmark between x86 and ARM cloud servers(https:// techblog.nexxwave.eu/benchmark-between-x86-and-arm-cloud-servers/)