Micronaut application URL works locally but not in kubernetes

Solution 1:

I assume that you use no reverse proxy or Ingress that might rewrite your path which could result in this error.

Based on the limited information my hypothesis is that you added the controller / path in a later stage of the application and rebuild the image. Kubernetes would check if a newer image is available since the image tag is :latest when creating a new Pod.

But you configured that the node should not check for newer images, if an image with matching tag is already present through the imagePullPolicy: IfNotPresent configuration.

If this is indeed the problem I suggest to either use unique image tags (f.e. git commit hash) or change the imagePullPolicy to Always so you get the latest image version as of the point in time the pod is created.