Remote Debug on Rancher
How to install required tools(Installation is one time operation):
Part 1
AWS CLI: Link
kubectl: Link
Once env build\rebuild activity is done, please go to your team's namespace\project on Rancher UI → Storage → ConfigMaps → telepresence-{{YourTeamName}}
Click on configMap and copy keyId and secretKey (it will be required later on)
if all of 3 prerequisite tools installed, please proceed with the following configurations:
AWS CLI:
command to execute: aws configure
paste previously copied keyId into in AWS Access Key ID prompt
paste previously copied secretKey into in AWS Secret Access Key prompt
type us-west-2 in Default region name prompt
type json in Default output format prompt
kubectl:
Command to execute: aws eks update-kubeconfig --region us-west-2 --name {{clusterName}} depending on there your environment has been deployed, that value should be placed in {{clusterName}} placeholder, in our case it's folio-edev
Once required tools installed and configured, visit: Folio Rancher Debugger
Part 2
Select desired namespace and deployment, click on "Start Debug" button
While the new target deployment's pod is being created, now it's time to start port-forward session, port-forward command will appear on UI(usually it takes ~10-15 seconds):
Copy command and paste to your terminal/cmd
Part 3: Configure IntelliJ IDEA
Step 1: Open Debug Configurations Dialog
In IntelliJ IDEA, go to Run menu → Edit Configurations...
Alternatively, use keyboard shortcut: Ctrl+Alt+R (Windows/Linux) or Cmd+Option+R (Mac)
Click the + button in the left sidebar to add a new configuration
Select Remote JVM Debug from the dropdown menu
Step 2: Create Remote Debug Configuration
Name: Enter a descriptive name (e.g., "Remote Debug - Spitfire - mod-audit")
Host: Set to
localhostPort: Set to
5005
Step 3: Configure VM Options
Enable Use module classpath: Check this option
Debugger mode: Select "Attach to remote JVM" (this should be default)
Transport: Select "Socket" (this should be default)
Step 4: Apply and Create Configuration
Click Apply to save the configuration
Click OK to close the dialog
Step 5: Start Port-Forward
Open your terminal/cmd and run the kubectl port-forward command that was displayed in the Debugger UI:
kubectl port-forward pod/{{pod-name}} 8081:8081 5005:5005 -n {{TargetNamespace}}This command forwards: - Port 5005: Java Debug Wire Protocol (JDWP) for debugging - Port 8081: Application port for local testing
Step 6: Launch Debug Session
In IntelliJ IDEA, select your newly created remote debug configuration from the dropdown in the top-right toolbar
Click the Debug button (green bug icon) to start the debug session
You should see in the Debug console: "Connected to the target VM"
Step 7: Set Breakpoints and Debug
Open the source code file in IntelliJ IDEA
Click in the left gutter next to the line number where you want to set a breakpoint
When the application hits the breakpoint, execution will pause
Use the Debug panel to: - Step through code (F10 to step over, F11 to step into) - View variables and expressions - Use the console to execute commands in the current context
Step 8: Stop Debugging
Click the Stop button in the Debug toolbar
(Optional) Terminate the port-forward session in terminal: Ctrl+C
Important Notes
Port-forwarding must be active while debugging; terminating it will disconnect the debug session
The debug port
5005is only available after you click "Start Debug" in the Folio Rancher Debugger UIIf you don't see the breakpoint hit, verify that:
The port-forward command is still running
The remote JVM configuration host and port match the port-forward settings
The breakpoint is in code that will be executed
You can have multiple debug configurations for different namespaces/deployments
Troubleshooting
Connection refused error: Verify the port-forward command is running in your terminal
Breakpoints not hitting: Ensure you're debugging the same code version that's deployed in the pod
Slow stepping through code: This is normal for remote debugging; network latency may cause delays