cpln workload connect
Overview
The cpln workload connect command is designed to establish a direct remote terminal connection to your workload replica at a specific location, allowing you to interact with the terminal session of the workload replica. This guide outlines how to effectively use the workload connect command, enabling you to perform tasks such as troubleshooting.
Prerequisites
- CLI installed and authenticated with a default profile, org and gvc.
- A running workload in at least one location. Refer to our create a workload guide.
- Permissions to interact with the workload.
Options
Required
--location
- The location associated with the workload deployment (e.g.,
aws-us-west-1
).
- The location associated with the workload deployment (e.g.,
Optional
--replica
- The replica name associated with the workload deployment. Defaults to the first replica.
--container
- The container name associated with the workload deployment. Defaults to the first container.
shell
,-s
- The shell to use upon connecting to the workload replica. Defaults to
bash
.
- The shell to use upon connecting to the workload replica. Defaults to
Basic Connect
To initiate a basic connection, you need the workload’s name and its deployment location.
Retrieve Workload Deployments
cpln workload get-deployments WORKLOAD_NAME
This command lists the available locations. Identify the location name from the output.
Connect to Workload
Example usage:
cpln workload connect WORKLOAD_NAME --location LOCATION
This command connects to the first replica and container in the specified location.
Advanced Connect
Specific Replica
In cases where there are more than one replica in a workload deployment and you would like to connect to a specific one, you can provide the --replica
option followed by the replicas name.
List Replicas
cpln workload replica get WORKLOAD_NAME --location LOCATION
To override the output format, use the --output
option followed by the desired format (YAML, JSON, etc.).
Connect to a Replica
Example usage:
cpln workload connect WORKLOAD_NAME --location LOCATION --replica REPLICA_NAME
Specific Container
Within a workload where numerous containers are configured, regardless if a container is handling traffic or functioning as a sidecar, it is feasible to establish a connection to it by using the --container
option.
Example usage:
cpln workload connect WORKLOAD_NAME --location LOCATION --container CONTAINER_NAME
Specific Shell
Different container environments may require or support different shells environments in order to connect, such as bash
or sh
.
To specify the shell, use the --shell
option.
Example usage:
cpln workload connect WORKLOAD_NAME --location LOCATION --shell SHELL_NAME