Initial Juju tutorial on Apple Silicon w Multipass

Hi @errcsool

First of all, yes you are correct, the reason is mismatching architecture. Your hardware and the VM are arm64 but the Postgres k8s charm is only built and released for amd64.

This can be verified in two ways:

  1. If you go to the charmhub here and click the version dropdown in the upper-left corner, you can see it only has amd64 versions.
  2. Or, the kubectl describe pod output you pasted also suggested the same.

Secondly, the solution you mentioned (change multipass vm to amd64) won’t work, because I do not think you can’t launch an amd64 VM on arm64 hardware with multipass. This feature will not come any time soon according to this discussion here: Announcing the first Release Candidate for Apple M1 support - #12 by saviq - Multipass - Ubuntu Community Hub.

As far as I know, the only tool that can launch cross-architecture VMs on arm64 is lima. See the official doc here. I think this might be the easy solution to finish the tutorial on arm64 machines, but I haven’t tried it yet, feel free to give it a go, I will also test this solution later.

If, for some reason, you have to stick with multipass, there is also a hard way:

  1. Clone the Postgres k8s charm repo, change the bases part to something like:
type: charm

bases:
  - build-on:
    - name: ubuntu
      channel: "22.04"
      architectures: [arm64]
    run-on:
    - name: ubuntu
      channel: "22.04"
      architectures: [arm64]
  1. Build arm64 version of the Postgres image. The repo for the image is here. This is needed because this image isn’t built for arm64. I have done this step already and published my image, so you can save yourself the trouble of doing it again by simply reusing my image. Tag: ironcore864/charmed-postgresql:14.10.

  2. Change the upstream-source in the metadata.yaml to use the aforementioned arm64 image.

  3. Pack and deploy the charm from local. When deploying, do not forget to set the arch constraint, you can either set it on the model or on the app level. Learn more about constraint here.

Although this is the hard way to go, it’s guaranteed to work, and you can learn more about juju/charms and even some other tools like rockcraft during ths journey.

I hope this helps.

As you go further with this tutorial, I think you will surely meet more issues related to arm64. Feel free to reach out again later :slight_smile: I will do a comprehensive tutorial for arm64/mac users later.

5 Likes