Enable Java TLS Capture in Kubernetes
When Keploy records traffic in Kubernetes with eBPF, native TLS libraries
(OpenSSL, BoringSSL, Go crypto/tls) are captured directly at the library
boundary. Java's built-in TLS stack (SunJSSE / javax.net.ssl) encrypts
payloads inside the JVM before bytes reach the kernel socket, so native eBPF
uprobes cannot read plaintext Java HTTPS calls.
To capture HTTPS traffic from Java workloads, Keploy attaches a lightweight
in-JVM agent (keploy-jsse-agent.jar) via -javaagent when recorded pods
start. If a recorded Java pod makes outbound HTTPS calls without that agent
active (or unable to reach the Keploy capture listener), Keploy reports a
java_tls_not_captured capture warning and pauses auto-replay for the affected
test sets so incomplete mocks do not cause false failures.
Enable Java TLS capture in the Helm chart
DaemonSet mode (daemonset.enabled=true)
Java TLS capture is enabled by default in the k8s-proxy chart
(daemonset.jvmAgent.enabled: true):
- At pod admission (recommended): the
k8s-proxymutating webhook mounts a read-only ConfigMap volume at/keploy-jssecontainingkeploy-jsse-agent.jarand sets-javaagentin_JAVA_OPTIONSon recorded containers (leaving your image'sJAVA_TOOL_OPTIONSuntouched). Non-JVM processes ignore_JAVA_OPTIONS. - At container startup (fallback): the DaemonSet node agent also injects the jar and preload constructor into matched JVM containers when the cgroup is created.
If a Java workload is reporting java_tls_not_captured, make sure Java TLS
capture and admission preload are enabled in your Helm release:
helm upgrade <release> keploy/k8s-proxy -n <keploy-namespace> \
--reuse-values \
--set daemonset.jvmAgent.enabled=true \
--set daemonset.scheduling.webhook.install=true
Check the following cluster settings that can prevent injection or delivery:
- Admission preload disabled: admission injection stays off when
daemonset.namespaced=true,rbac.create=false,recording.readOnly=true,daemonset.scheduling.webhook.install=false, ordaemonset.jvmAgent.enabled=false, or ifKEPLOY_DS_JVM_PRELOAD=falseis set on thek8s-proxycontrol-plane Deployment. - Per-pod opt-out annotation: remove
keploy.io/jsse-inject: "false"from any pod template whose Java HTTPS traffic you want recorded. - Loopback port conflict: by default (
daemonset.jvmAgent.podListener.enabled: true), each recorded JVM sends captured plaintext over a per-pod transport (127.0.0.1:16790loopback, or a Unix socket in the pod's/dev/shmwhen the DaemonSet runs withoutCAP_SYS_ADMIN). Because traffic stays local to the pod, cluster NetworkPolicies do not block it. Keploy opens the loopback listener on127.0.0.1:16790before your application starts (and keeps it bound for the life of the pod's network namespace, so a container restart does not release it); if your application needs port16790, set--set daemonset.jvmAgent.podListener.port=<free-port>. - Node-listener fallback and NetworkPolicies: sandboxed runtimes (such as
Kata or gVisor) or clusters that set
daemonset.jvmAgent.podListener.enabled=falsefall back to sending captured TLS plaintext to the node's DaemonSet listener. In that setup, ensure your NetworkPolicy or host firewall allows pod-to-own-node egress to the DaemonSet JSSE listener port.
Sidecar mode (daemonset.enabled=false)
In Sidecar mode with low-latency recording enabled, the k8s-proxy admission
webhook automatically stages keploy-jsse-agent.jar into a shared emptyDir
volume and injects -javaagent into the application container when it detects a
JVM workload and recording starts. If your JVM isn't detected (for example,
behind a custom entrypoint), set keploy.io/jsse-inject: "true" on the pod
template. Ensure the pod is not opted out with keploy.io/jsse-inject: "false"
and that the deployment rolls onto the mutated pod when you start recording.
Re-record from the Keploy Dashboard
Java TLS capture is configured on the cluster rather than as a per-run UI
toggle. Because a JVM only loads -javaagent at process startup, pods that were
already running before Java TLS capture was enabled must be re-recorded:
- Open the Recordings page in the Keploy Dashboard and stop the affected recording if it is still running.
- Start a new recording for the Java deployment. Keploy restarts the targeted
pods under capture so each JVM starts with
keploy-jsse-agent.jarattached. - If you intentionally want to replay an older paused recording without its missing Java HTTPS mocks, open the Auto-replay paused notice in the dashboard and select Replay anyway.
Verify Java TLS capture is active
1. Check the recorded Java pod
Inspect a pod running under an active recording:
kubectl exec -n <app-namespace> <pod-name> -- sh -c '
env | grep -E "JAVA_TOOL_OPTIONS|_JAVA_OPTIONS"
ls -l /keploy-jsse/ /keploy/ 2>/dev/null
'
You should see -javaagent:...keploy-jsse-agent.jar in _JAVA_OPTIONS
(admission injection) or JAVA_TOOL_OPTIONS (node preload), with
keploy-jsse-agent.jar present in /keploy-jsse/ or /keploy/.
2. Check the DaemonSet agent logs
In DaemonSet mode, inspect the data-plane agent logs on the pod's node:
kubectl logs -n <keploy-namespace> -l app.kubernetes.io/component=data-plane --tail=100 \
| grep -iE "JSSE|JVM PRELOAD"
At startup, the agent logs JSSE: per-pod capture transports confirming that
podLoopback or podUnixSocket is ready. If the preload could not attach
-javaagent, the log reports JVM PRELOAD DECLINED or
JVM PRELOAD BAIL OBSERVED along with the reason (for example, JVM option
limits or missing permissions).
3. Confirm clean capture in the dashboard
Send HTTPS requests through the recorded Java service and verify that:
- Outbound HTTPS dependencies appear as mocks in the newly recorded test set.
- No
java_tls_not_capturedwarning or Auto-replay paused banner appears for the new recording.