Part 3 - Creating OCI images for arm64
This is part 3 of playing around with kubernetes on Raspberry Pi’s.
After installing the kubernetes clusters on Raspberry Pi’s, I encountered an issue with running my application on it.
I noticed a /exec
error in the logs on my pod.
After inspecting this, I realized I was trying to run a OCI image that was generated with amd64 on an arm architecture hardware.
My initial docker file was using openjdk:16-jdk-alpine
as the base image, which had support for only amd64.
I switch the base image to openjdk:22-jdk-slim
, as it supported both amd64 and arm64
With this change, there was a need to generate images for my application for both amd64 and arm64
- To do this, I used
docker
cli to create and push the OCI images first.
docker buildx build --platform linux/amd64 -t rjain/sample-k8s-app:latest-amd64 --push .
docker buildx build --platform linux/arm64 -t rjain/sample-k8s-app:latest-arm64 --push .
- Next I created a manifest file to reference it on docker hub, that made both the images available under 1 tag
```
docker manifest create
rjain/sample-k8s-app:latest
–amend rjain/sample-k8s-app:latest-amd64
–amend rjain/sample-k8s-app:latest-arm64
docker manifest push rjain/sample-k8s-app:latest
* Once the images were available in docker hub, I was able to [deploy](https://github.com/rahulkj/sample-k8s-app/blob/main/deployment.yaml) my app, and validate it using my ingress endpoint
curl http://sample.k8s.int:30972/hello
{“greetingMessage”:”Hi from k8s deployment!!”} ```
NOTE:
I created a A record for *.k8s.int
that maps to one of the kubernetes node