cpln port-forward command creates a secure tunnel between your local machine and a workload, allowing you to access ports without exposing them publicly. Similar to kubectl port-forward, this enables local access to databases, internal services, and debugging endpoints.
When to use this
Access databases
Connect to PostgreSQL, MySQL, Redis, or other databases running in workloads
Debug internal services
Access admin panels, metrics endpoints, or debug ports locally
Local development
Test against live services without deploying your code
Private service access
Interact with services that aren’t publicly exposed
Prerequisites
CLI installed
CLI installed
Install the Control Plane CLI. See Installation.
Running workload
Running workload
You need a running workload in at least one location. See the Create a Workload guide.
Required permissions
Required permissions
You need
connect permission on the workload. See Workload Permissions.Basic usage
localhost:<local-port> to <remote-port> on the workload.
Options
| Option | Description |
|---|---|
--address | Local addresses to listen on, comma-separated (default: localhost) |
--location | Target location (defaults to first available in GVC) |
--replica | Target a specific replica (defaults to any available) |
Port format options
- Different ports
- Same port
- Ephemeral port
Map a different local port to the remote port:Access the database at
localhost:5433.Forward multiple ports
Forward several ports in one command:localhost:8080(HTTP)localhost:8443(HTTPS)localhost:9090(metrics)
Listen on multiple addresses
Expose the forwarded port on multiple network interfaces:192.168.1.10:5432.
Target specific locations
Forward to a workload in a specific location:Common workflows
Connect to PostgreSQL
Access Redis
Debug a web service
Access admin panels
Port forwarding to unexposed ports
You can forward to any port on the workload, even if no container is listening on that port.This is useful for debugging or accessing services that bind to ports dynamically.
Troubleshooting
Port already in use
Port already in use
The local port is occupied. Use a different port or an ephemeral port:
Connection refused
Connection refused
The workload may not be listening on that port. Verify the container port:Check the
ports section in the container spec.No replicas found
No replicas found
The workload may not be running in the specified location:Try a different location or wait for replicas to start.
Permission denied
Permission denied
You need
connect permission on the workload. Check your policies.