cpln workload exec
Overview
The cpln workload exec command lets you execute a specific command followed by custom arguments in a workload replica at a specific location.
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.,
--
- Command to execute on replica (e.g.,
echo hello world
).
- Command to execute on replica (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.
Basic Execute
Retrieve Workload Deployments
cpln workload get-deployments WORKLOAD_NAME
This command lists available locations. Identify the location name from the output.
Execute
Example usage:
cpln workload exec WORKLOAD_NAME --location LOCATION -- COMMAND ARG1 ARG2
Advanced Execute
Specific Replica
In cases where you have more than one replica in a workload deployment and you would like to execute a command in one of them, 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.).
Execute Within a Specific Replica
Example usage:
cpln workload exec WORKLOAD_NAME --location LOCATION --replica REPLICA_NAME -- COMMAND ARG1 ARG2
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 execute a command to it by using the --container
option.
Example usage:
cpln workload exec WORKLOAD_NAME --location LOCATION --container CONTAINER_NAME -- COMMAND ARG1 ARG2