Skip to main content
The 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

Install the Control Plane CLI. See Installation.
You need a running workload in at least one location. See the Create a Workload guide.
You need connect permission on the workload. See Workload Permissions.

Basic usage

This forwards traffic from localhost:<local-port> to <remote-port> on the workload.
You can get a ready-to-use port-forward command from the Console. Navigate to your workload, click Connect in the left pane, and copy the port-forward command which includes the location and port mapping (e.g., 80:80).

Options

Port format options

Map a different local port to the remote port:
Access the database at localhost:5433.

Forward multiple ports

Forward several ports in one command:
Access the app at:
  • localhost:8080 (HTTP)
  • localhost:8443 (HTTPS)
  • localhost:9090 (metrics)

Listen on multiple addresses

Expose the forwarded port on multiple network interfaces:
This allows other machines on your LAN to connect through 192.168.1.10:5432.
Listening on non-localhost addresses exposes the port to your network. Use with caution.

Target specific locations

Forward to a workload in a specific location:
Choosing a location closer to you reduces latency.

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

The local port is occupied. Use a different port or an ephemeral port:
The workload may not be listening on that port. Verify the container port:
Check the ports section in the container spec.
The workload may not be running in the specified location:
Try a different location or wait for replicas to start.
You need connect permission on the workload. Check your policies.

Next steps

Connect to Workloads

Interactive shell access

Execute Commands

Run commands in containers

Copy Files

Transfer files to/from workloads

Command Reference

Full port-forward command reference