How do you monitor memory/cpu usage of a Spring Boot service in Kubernetes?
TechnicalTech lead javaJava Tech LeadDevOps EngineerSoftware EngineerTo monitor memory and CPU usage of a Spring Boot service in Kubernetes, I use Prometheus for metrics collection and Grafana for visualization. I configure the Spring Boot application with the Micrometer library to expose metrics via the /actuator/prometheus endpoint. Then, I set up Prometheus to scrape these metrics at regular intervals.
Additionally, I leverage Kubernetes' built-in metrics server to get real-time resource usage. This allows me to set up alerts for any anomalies, ensuring optimal performance.