Does anyone had success implementing preStop hook with distroless/java17:nonroot ? Here is my (default) deployment:
# [...]
lifecycle:
preStop:
exec:
command: ["sh", "-c", "sleep 10"]
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
privileged: false
runAsUser: 65532
capabilities:
drop:
- ALL
volumeMounts:
- name: tmp-volume
mountPath: /tmp
Solved using actuator endpoint