Hello,
I'm using the last spring boot version 3.1.4 and gradle as build tool. I created a native image with the gradle plugin (bootBuildImage): if I run the created image from my docker desktop it works perfectly, but when i run it on kubernetes nothing happens, the pod just starts a crashbackoff loop without logs.
I've tried to put a sleep when the pod is created and then access the pod and launch the executable manually, but nothing happens, no logs or errors are shown, just a new line. The same in the container created by running the image works fine.
I've tried this in both my local kubernetes cluster and my personal azure cluster, same issue.
My gradle build
bootBuildImage {
environment = [
"BP_JVM_VERSION" : "21",
"BP_NATIVE_IMAGE": "true",
"BP_NATIVE_IMAGE_BUILD_ARGUMENTS": "-H:-UseContainerSupport"
]
builder = "paketobuildpacks/builder-jammy-base:latest"
}
Also tried with this dockerfile
FROM container-registry.oracle.com/graalvm/native-image:21 AS graalvm
COPY . /app
WORKDIR /app
RUN ./gradlew nativeCompile
FROM docker.io/oraclelinux:9
EXPOSE 8080
# # For Gradle build
COPY --from=graalvm /app/build/native/nativeCompile/registration registration
With a non-native image, everything works fine.
I'm getting crazy with this...
Comment From: scottfrederick
Thanks for getting in touch. Unfortunately, if the application runs fine locally but only fails in Kubernetes, I'm not sure how much help we can provide. If you can share a complete minimal sample that reproduces the problem on a local Kubernetes deployment like kind or minikube along with complete instructions so that we can build and run it ourselves, we'd be happy to take a look. You can share a sample with us by pushing it to a separate repository on GitHub or by zipping it and attaching it to this issue.
Comment From: saugion
I tried to reproduce it creating another project, but in works fine... It's really strange, I've also added the same artifacts but it still works. I think the issue could be related to the pod's memory. Thanks anyway