Spring Boot 4 on Kubernetes: probes, graceful shutdown, limits and JVM ergonomics
Companion project for Deploying Spring Boot 4 on Kubernetes: Probes, Graceful Shutdown, Limits and JVM Ergonomics
on ankurm.com.
A small Spring Boot 4 service, the manifests that deploy it, and one script per experiment - a
dependency outage under three probe configurations, a rolling restart under load four ways, the JVM's
ergonomic choices for nine pod shapes, the same GC-heavy load under five CPU limits, and a
HorizontalPodAutoscaler driven by a Micrometer gauge. Every figure in the article is in
docs/output/.
Versions
|
|
| Spring Boot |
4.1.1 |
| JDK |
Temurin 25.0.4.1 (in gcr.io/distroless/java25-debian13:nonroot) |
| Kubernetes |
k3s v1.36.4+k3s1, single node, 2 vCPU / 8 GB, cgroup v1 (docs/01-the-lab.md) |
| Prometheus |
3.14.0 |
| prometheus-adapter |
0.12.0 |
Quickstart
What is in it
| Path |
|
k8s/orders.yaml |
the baseline Deployment: startup/liveness/readiness probes, preStop: sleep, MaxRAMPercentage=75 |
k8s/downstream.yaml |
a dependency to take away |
k8s/gc-lab.yaml |
the single pod the CPU-limit experiment reshapes |
k8s/hpa/ |
Prometheus, prometheus-adapter with one rule, the HPA |
WorkController |
/work (timed requests, the app.inflight.requests gauge), /alloc (GC load) |
DownstreamHealthIndicator |
a health indicator whose probe group is the experiment |
JvmController |
/diag/jvm, /diag/gc - ergonomics and cgroup throttling counters. Diagnostic; delete before shipping |
LoadGen |
the in-cluster load generator, run from the same image |
Documentation
- The lab
- Probes: which checks belong in which probe
- JVM ergonomics: what the JVM decides from your pod spec
- CPU limits and the garbage collector
- Graceful shutdown and the rolling-update race
- HPA on a custom Micrometer metric
Captured output