postgres-operator: Postgres Operators fails to start on Minikube 1.26.0 with qemu2 driver on ARM64
Please, answer some short questions which should help us to understand your problem / question better?
- Which image of the operator are you using? registry.opensource.zalan.do/acid/postgres-operator:v1.8.2
- Where do you run it - cloud or metal? Kubernetes or OpenShift? Kubernetes / Minikube 1.26.0 with qemu2 driver / Apple M1 Ultra
- Are you running Postgres Operator in production? Yes
- Type of issue? Bug report
Some general remarks when posting a bug report:
I’m using Minikube 1.26.0 with the qemu2
driver on Apple M1 silicon and the operator fails with the following error:
postgres-operator exec /postgres-operator: exec format error
Using the latest PostgreSQL operator (1.8.2) works as expected on this same version of Minikube on Apple M1 silicon using the docker
driver.
Unfortunately, the pod immediately terminates so I’ve been unable to gather any log files. Does the postgres-operator support ARM64?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 23 (1 by maintainers)
Quoted from release page:
We are excited to announce a new release of the Postgres Operator. A rather small one but bringing you ARM support for the operator (pooler, ui and logical backup will follow). Thanks to everyone who contributed with PRs, feedback, raising issues or providing ideas.
New features
Provide Postgres-Operator as multi-arch image that can run on arm (#2268, #2127) …
@abangser glad you found the solution yourself. As you mentioned, you’ve used the wrong docker-context to build the image.
The script I’m using to build a multiarch images is the following (and is located in another directory):
However, I’m not yet using the makefile. @abangser would be awesome if you could file a PR with your change to my fork (https://github.com/mmoscher/postgres-operator/tree/arm64). Then we can work on from there and file a PR to this repo soon.
FYI: running this script on my Mac M1, using colima as docker backend, takes roughly 5m for the multiarch images to build (base images cached). However, 20m could be fine to (based on your hardware).
Thanks for the update @jonizen! 🙇
That is interesting that it did work for you. I ended up tracking down an issue where the Dockerfile has a
COPY . .
and that is paired with a line in the makefile that runs the docker command from theDOCKERDIR
. This means that the only files available in the image are the files in theDOCKERDIR
which is obviously not enough and doesn’t include thego.mod
.I fixed this by using the following
docker
make target:Which has resulted in this image (no guarantee of longevity of, or updates to, this image as we are currently only using it for a demo!).
While this worked for me, I have to say I am intrigued how you ended up getting yours building as I might be doing something too heavy handed. The image did take something like 20 minutes to build!
I tried it out and i could build it and push the image without any problems. 😃 link to image
@joepa37 see if that works 😃
@mprimeaux spilo linux/arm64 support has been merged yesterday https://github.com/zalando/spilo/pull/790 and will be available with the next spilo tag (postgresql version >= 14 support only).
Now we can continue with the operator itself to get it linux/arm64 compatible. However, its baseimage registry.opensource.zalan.do/library/alpine-3.xx, is not yet available with linuxarm64 architecture in the zalando registry.
As mentioned in #2084 two options feasible. The second option, eg. hosting on ghcr.io, would be my favorite one to go with. Nevertheless, I’d no time yet to implement it. Maybe I’ve some free time at the end of the week/weekend.
For now, you can build it your self with some small changes: https://github.com/mmoscher/postgres-operator/pull/1/files
TL;DR: I’m still on it 😉
@mprimeaux building the operator on an aarch64 (linux/arm64) machine (Google Cloud Tau T2A GCE Instance) worked out for me, i.e. customizing the Makefile+Dockerfile and overriding the operator’s default image (helm chart values). Additionally, one has to use the custom, arm64 compatible, spilo image which is already available in the Zalando registry. Will test this tomorrow/next week on an Apple Silicon M1 processor. If the PoC works well-enough, I’ll file a pull request.
I think the latest release already included this changes, but you have to specify the correct image.
Look at the latest release on the release page. I also think the other parts for pooling and backup is planed 😊
Thanks! I will test this out today and reply on the PR and here.
Absolutely appreciate it would be helpful. As I mentioned in this PR, it seems to be working for me and is as far as I can/will take a commit at this time as I am not aware of where else to go. Please feel free to merge or of course rewrite if it isn’t quite right.
https://github.com/mmoscher/postgres-operator/pull/2#issuecomment-1544079462
Thanks
Yeah, I pushed the wrong image, but I got the arm64 one. So it works I believe 😊
Be aware that your output says “cached” if you cache a step that fails, you can have it all correct. Since this image builds fast, run --no-cache to rule that out.
I will have a look at this probably today after work 😊
@joepa37 I had a similar problem building on my M1 and similarly ran into the situation where @jonizen’s image was still the AMD arch.
My fix was to make 2 small changes to the code from @mmoscher (thank you!) to do a docker buildx command and build both arches.
My new make target code was:
I removed the hardcoding of the two ARGs in the dockerfile on lines 5 and 6 to be passed in.
These changes allowed me to run the following command:
but still got an error 😢
This one feels more like something other than ARCH (edit: this is failing the same way on the branch with the docker changes but not on master branch when building on a M1 mac), but I may be missing how my changes impacted it. I will keep poking, but if anyone has an idea please let me know! Thanks 🙇
@mmoscher Any updates on the
arm64
support? Please let me know how (or if) I can help. I’ll make time.