Add kubernetes-deployment: probes, shutdown, JVM ergonomics, HPA

Companion code for "Deploying Spring Boot 4 on Kubernetes: Probes, Graceful
Shutdown, Limits and JVM Ergonomics". A dependency outage under three
probe-group setups, a rolling restart under load four ways (three runs
each), the JVM's ergonomic choices for nine pod shapes, one GC-heavy load
under five CPU limits with throttling counters, and an HPA driven by a
Micrometer gauge through prometheus-adapter. Measured on k3s v1.36.4.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01C3TETMrqVUWeFkNtz3Jbo3
This commit is contained in:
2026-09-11 17:12:10 +00:00
co-authored by Claude Opus 5
parent 644da9e65e
commit a065696478
72 changed files with 28415 additions and 2 deletions
@@ -0,0 +1,75 @@
# Minimal Prometheus: scrapes every pod labelled app=orders on /actuator/prometheus every 5 s and
# keeps the namespace and pod as labels - prometheus-adapter needs both to map a series to a pod.
apiVersion: v1
kind: Namespace
metadata: {name: monitoring}
---
apiVersion: v1
kind: ServiceAccount
metadata: {name: prometheus, namespace: monitoring}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata: {name: prometheus-sd}
rules:
- apiGroups: [""]
resources: [pods, endpoints, services]
verbs: [get, list, watch]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata: {name: prometheus-sd}
roleRef: {apiGroup: rbac.authorization.k8s.io, kind: ClusterRole, name: prometheus-sd}
subjects: [{kind: ServiceAccount, name: prometheus, namespace: monitoring}]
---
apiVersion: v1
kind: ConfigMap
metadata: {name: prometheus, namespace: monitoring}
data:
prometheus.yml: |
global:
scrape_interval: 5s
scrape_configs:
- job_name: orders
metrics_path: /actuator/prometheus
kubernetes_sd_configs:
- role: pod
namespaces: {names: [demo]}
relabel_configs:
- source_labels: [__meta_kubernetes_pod_label_app]
regex: orders
action: keep
- source_labels: [__meta_kubernetes_pod_container_port_number]
regex: "8080"
action: keep
- source_labels: [__meta_kubernetes_namespace]
target_label: namespace
- source_labels: [__meta_kubernetes_pod_name]
target_label: pod
---
apiVersion: apps/v1
kind: Deployment
metadata: {name: prometheus, namespace: monitoring}
spec:
replicas: 1
selector: {matchLabels: {app: prometheus}}
template:
metadata: {labels: {app: prometheus}}
spec:
serviceAccountName: prometheus
containers:
- name: prometheus
image: quay.io/prometheus/prometheus:v3.14.0
imagePullPolicy: Never
args: ["--config.file=/etc/prometheus/prometheus.yml", "--storage.tsdb.retention.time=2h"]
ports: [{containerPort: 9090}]
resources: {requests: {cpu: 50m, memory: 128Mi}, limits: {memory: 512Mi}}
volumeMounts: [{name: config, mountPath: /etc/prometheus}]
volumes: [{name: config, configMap: {name: prometheus}}]
---
apiVersion: v1
kind: Service
metadata: {name: prometheus, namespace: monitoring}
spec:
selector: {app: prometheus}
ports: [{port: 9090, targetPort: 9090}]