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

Multi-Architecture Container Images: Why Bother, and How To

Multi-Architecture Container Images: Why Bother, and How To

All of us, from the hobbyist to the enterprise solutions architects we are faced with downloading software from the Internet and making it work. The first hurdle is getting the new software to run on our computer and that's where we run into so much trouble.

Too often, containers are produced with just a single CPU architecture in mind. As non-traditional architectures become more common, this "make it work" problem gets harder. But there's a way to continue to make it work with our beloved containers.

Sit in and learn more about how container registries know which container to give you, and what a container even is, how to build container images which support multiple CPU architectures, and why it all even matters.

Lisa Seelye

October 24, 2019
Tweet

More Decks by Lisa Seelye

Other Decks in Programming

Transcript

  1. #LISA19 @thedoh
    IMAGINE

    View full-size slide

  2. #LISA19 @thedoh
    THE NEXT LEVEL

    View full-size slide

  3. #LISA19 @thedoh
    LET DOWN

    View full-size slide

  4. MULTI-ARCH CONTAINER IMAGES
    WHY BOTHER, AND HOW TO
    #LISA19 @thedoh

    View full-size slide

  5. #LISA19 @thedoh
    ABOUT ME
    Lisa Seelye thedoh
    Sr. SRE at Red Hat
    Cat enthusiast
    Alternate arch enthusiast
    Sysadmin & Sw. Eng background

    View full-size slide

  6. #LISA19 @thedoh
    THE GROUND RULES
    DOCKER, DOCKER
    DOCKER, DOCKER

    View full-size slide

  7. #LISA19 @thedoh
    WHAT LEVEL ARE WE
    ON?
    LOW LEVEL

    View full-size slide

  8. CONTAINER IMAGES
    LET'S HAVE A LOOK
    #LISA19 @thedoh

    View full-size slide

  9. #LISA19 @thedoh
    DO YOU THINK THIS?
    CONTAINER SHIPS

    SHIPPING CONTAINERS

    View full-size slide

  10. #LISA19 @thedoh
    BUT, WHAT IF IT'S ALL A LIE?

    View full-size slide

  11. #LISA19 @thedoh
    THIS IS YOUR IMAGE
    saved with go-containerregistry pkg/v1/tarball
    $ tar xvf image.tar

    x sha256:4fd1e92090d4d5128fac6b023f9067456ef...

    x 43ef5679e440ba5060f276db0a83af9588ee9ec650....tar.gz

    x 1b8349f9c8bdb67c8167d2ec1234d8dc94deee42bc....tar.gz

    x manifest.json

    $

    View full-size slide

  12. #LISA19 @thedoh
    IS THIS CONTAINER THING A GIANT SCAM? I MEAN, TARBALLS?? REALLY?!
    INSIDE THE IMAGE TARBALL
    ▸ JSON Config file (sha256:somehash)
    ▸ Layer tarballs (yaddayadda.tar.gz)
    ▸ JSON manifest file (manifest.json)

    View full-size slide

  13. #LISA19 @thedoh
    BUT LISA, HOW DO I
    GET AN IMAGE??

    View full-size slide

  14. #LISA19 @thedoh
    WE HAVE TO GO DEEPER

    View full-size slide

  15. #LISA19 @thedoh
    YEAH, BUT JUST GIVE ME ONE
    DOCKER PULL THEDOH/LISA19
    ▸ No Manifest List
    ▸ Widely used
    ▸ Gives you the requested image, no
    questions asked
    ▸ Manifest list
    ▸ Not as widely used
    ▸ Gives you layers appropriate for your
    platform (sometimes)

    View full-size slide

  16. #LISA19 @thedoh
    RUNNING ON AMD64
    THEDOH/LISA19:AMD64-19.08.1

    View full-size slide

  17. #LISA19 @thedoh
    SAD TIMES ON ARM64
    THEDOH/LISA19:AMD64-19.08.1

    View full-size slide

  18. ALTERNATE ARCHITECTURE EXPERIENCE
    REAL WORLD EXPERIENCES
    #LISA19 @thedoh

    View full-size slide

  19. #LISA19 @thedoh
    INSTALLING STUFF INTO ARM64 KUBERNETES
    SOFTWARE ATTEMPTED
    ▸ Kubernetes Dashboard
    ▸ Velero and Helm (v2)
    ▸ Tekton Pipelines & Kaniko

    View full-size slide

  20. #LISA19 @thedoh
    Searching for Velero install docs

    View full-size slide

  21. #LISA19 @thedoh
    Found the docs!

    View full-size slide

  22. #LISA19 @thedoh
    More docs! We are close

    View full-size slide

  23. #LISA19 @thedoh
    ARM64!! We're supported!! Yay!!

    View full-size slide

  24. #LISA19 @thedoh
    Gooooooooo!!!!

    View full-size slide

  25. #LISA19 @thedoh
    IT WORKED!!!!

    View full-size slide

  26. #LISA19 @thedoh
    Not so fast

    View full-size slide

  27. #LISA19 @thedoh
    EXEC FORMAT ERROR
    WHAT THE HECK DOES THAT
    MEAN?

    View full-size slide

  28. #LISA19 @thedoh
    WHY DOES THIS WEIRD ALTERNATE ARCH STUFF MATTER?
    IT'S ABOUT POSITIVE USER EXPERIENCE
    ▸ Kubernetes Dashboard docs pointed me to an
    amd64 image
    ▸ Velero and Helm (v2) both have ARM64
    installers, but give amd64 images
    ▸ Other tools and libraries make assumptions
    about the environment

    View full-size slide

  29. #LISA19 @thedoh
    DOCS AND CULTURE
    SAY ONE THING WHILE
    IMAGES SAY ANOTHER

    View full-size slide

  30. IMAGE MANIFEST LIST
    GIVE ME A LIST TO PICK FROM, OK?
    #LISA19 @thedoh

    View full-size slide

  31. #LISA19 @thedoh
    INSIDE AN IMAGE MANIFEST
    ARM64 AMD64

    View full-size slide

  32. #LISA19 @thedoh
    MANIFEST LISTS

    View full-size slide

  33. #LISA19 @thedoh
    MANIFEST LISTS + IMAGE MANIFEST

    View full-size slide

  34. #LISA19 @thedoh
    LISTS ARE THE FUTURE
    WITH MANIFEST LISTS
    ▸ Reference multiple arches with one logical
    image name
    ▸ Image registry gives you the right layer files
    based on requested platform
    ▸ Requesting an unlisted arch fails at pull-time*,
    not runtime

    View full-size slide

  35. BUT HOW?
    MANIFEST LISTS, COOL, COOL...
    #LISA19 @thedoh

    View full-size slide

  36. #LISA19 @thedoh
    BUILDING MANIFEST LISTS
    ...BY HAND

    View full-size slide

  37. #LISA19 @thedoh
    BUILDING MANIFEST LISTS
    WITH MAKE

    View full-size slide

  38. #LISA19 @thedoh
    WHY BOTHER?

    View full-size slide

  39. #LISA19 @thedoh
    MAKEFILES AREN'T REASON ENOUGH?
    BENEFITS OF MANIFEST LISTS
    ▸ Seamlessly support multiple architectures
    ▸ Simplifies docs, which people don't like
    writing anyways
    ▸ ARM64 is coming. Amazon has EC2 instances;
    which vendor will make the next move?
    ▸ Maybe shift to an inclusive mindset when
    coding

    View full-size slide

  40. #LISA19 @thedoh
    I HAVE A CONFESSION
    THIS TALK IS ABOUT
    SOFTWARE
    DEVELOPMENT
    PHILOSOPHY, TOO.

    View full-size slide

  41. #LISA19 @thedoh
    THE REAL INTENT, PART TWO
    THE IDEA APPLIES TO SOFTWARE ENGINEERING
    ▸ Opinionated software libraries have their
    opinions carried forward
    ▸ Single architecture assumptions aren't portable
    ▸ Examples include:
    ▸ go-containerregistry
    ▸ kaniko, because it uses go-containerregistry

    View full-size slide

  42. #LISA19 @thedoh
    github.com/google/go-containerregistry pkg/v1/remote/index.go (6991786)

    View full-size slide

  43. #LISA19 @thedoh
    BRIEF INTERLUDE
    WHAT IS KANIKO?
    ▸ Software that uses go-containerregistry to pull
    images to build new images
    ▸ Builds container images in Kubernetes, without
    Docker socket
    ✴ Why? The Docker socket =~ root
    ▸ Scratches the "let's do everything in
    Kubernetes" itch
    ▸ github.com/GoogleContainerTools/kaniko

    View full-size slide

  44. #LISA19 @thedoh
    KUBERNETES CI/CD PIPELINE
    TEKTON PIPELINES
    ▸ Open source Kubernetes native CI/CD Platform
    ▸ Can use kaniko to build container images
    ▸ Also only amd64 images
    ▸ github.com/tektoncd/pipeline
    Photo: Corinne Alstrom-Sonne

    View full-size slide

  45. #LISA19 @thedoh
    KUBERNETES CI/CD PIPELINE
    PORTING TEKTON PIPELINES TO ARM64
    ▸ Depends on google/ko to build
    ✴ But google/ko depends on go-
    containerregistry
    ▸ Building fails in the build system, not software
    code
    ▸ Welcome to dependency hell :(

    View full-size slide

  46. #LISA19 @thedoh
    CREATE & DISTRIBUTE

    View full-size slide

  47. #LISA19 @thedoh
    ACTIONS FOR US ALL
    UNDERSTAND THE CULTURE AND GOALS
    TILT TOWARDS CROSS-PLATFORM

    View full-size slide

  48. #LISA19 @thedoh
    THE END
    Code & Makefiles
    github.com/lisa/lisa19-containers
    Slides & Image Credits
    lisa.dev/conferences#lisa19
    MULTI-ARCHITECTURE CONTAINER IMAGES:

    WHY BOTHER, AND HOW TO

    View full-size slide