Video in progress
You moved Actuator to a separate management port. How does this affect Kubernetes probes and security?
With a separate management.server.port, it is easy to keep Actuator away from external traffic. But the probes stop checking the main port: even if the main Tomcat is stuck, the management port may still say "UP". So the probes should also be exposed on the main port.
📖 Answer
server:
port: 8080
management:
server:
port: 8081 # actuator only on this port
endpoints:
web:
exposure:
include: health, prometheus
endpoint:
health:
probes:
enabled: true
add-additional-paths: true # /livez and /readyz on the main port too
The benefit: the Ingress exposes only 8080 to the outside, and 8081 stays inside the cluster, for Prometheus and probes. Dangerous endpoints such as heapdump and env do not end up on the internet by accident.
The problem: the management port runs in its own separate web server. If the main Tomcat's thread pool is full or its connector is dead, 8081/actuator/health/liveness still returns UP. Kubernetes considers the pod healthy, while users get timeouts.
That is why add-additional-paths: true makes /livez and /readyz appear on the main server port too. Point the probes at these:
livenessProbe:
httpGet: { path: /livez, port: 8080 }
readinessProbe:
httpGet: { path: /readyz, port: 8080 }
Now the probe checks along the path real requests take, and the rest of Actuator stays on the closed port.
Two more things: if you have Spring Security, make /livez and /readyz permitAll, because the kubelet does not send a token. Also point the Prometheus scrape configuration (ServiceMonitor or annotations) at port 8081, otherwise the metrics silently vanish.
Sign up to mark studied questions and save your progress.