0

I have a simple Spring Boot app (Spring Boot 3.0.0, Java 17) deployed to Kubernetes. The app is straightforward at the moment. It has a PostgreSQL DB connection with a couple of Flyway migrations and a basic REST controller.

The application starts fine on my machine (MacBook Pro M1 Max), both in the IDE and in a Docker container. I use amazoncorretto:17 as a base image. Docker has more than enough resources.

Docker resources configuration

However, when I deploy the application in a local K8s cluster created with Minikube the application is incredibly slow. Previously, it could become irresponsible with CPU consumption constant at 100%. I could not connect to java process to take a thread dump or a heap dump due to timeouts. Apparently, there is not enough resources for the application. However, I cannot understand why.

Excessive CPU consumption

Below are a couple of differences between the app in minikube and in IDE.

App start time locally vs App start time in minikube

I started the minikube with the following configuration:

minikube start --cpus 7 --memory 16000 --driver=docker

Resources for the container (I also tried with up to 4 CPUs, same issue):

         resources:
            limits:
              cpu: 2
              memory: 3024Mi
            requests:
              cpu: 1
              memory: 1024Mi

I deployed the same configuration to AWS EKS. The application works there.

Is it a known issue with minikube or a misconfiguration? Are there any configuration options that I miss? Are there reliable alternatives to minikube for local development?

  • WIthout knowing what is happening in your app this will be impossible to answer. 1 cpu might be a little low but I don't know. Generally most of the time, during startup, is spend trying to connect and validate the database. But as stated without knowing more about your application this will be impossible to answer. – M. Deinum Mar 30 '23 at 14:05
  • Try without the CPU and the memory config i.e. `minikube start --driver=docker`. – Arvind Kumar Avinash Mar 30 '23 at 14:07
  • @M.Deinum I tried with 4 CPUs as requests/limits, same result. My working assumption is that something is wrong with the cluster itlself. No idea what, unfortunately. – Slava Kruglov Mar 30 '23 at 15:36
  • @ArvindKumarAvinash I am not sure it would help, the default CPU/memory settings are lower in minikube (https://github.com/kubernetes/minikube/blob/232080ae0cbcf9cb9a388eb76cc11cf6884e19c0/pkg/minikube/constants/constants.go#L102) – Slava Kruglov Mar 30 '23 at 15:37
  • After many other attempts there is still no imrovement. I eventually decided to replace Minikube with something else. I also found a blog post from Nicolas Frankel mentioning performance issues with Minikube: https://blog.frankel.ch/goodbye-minikube/ – Slava Kruglov Apr 06 '23 at 18:14

0 Answers0