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
--
- Command to execute on replica (e.g.,
echo hello world
).
- Command to execute on replica (e.g.,
Optional
--stdin
,-i
- Pass stdin to the container. Default:
false
.
- Pass stdin to the container. Default:
--tty
,-t
- Stdin is a TTY. Default:
false
.
- Stdin is a TTY. Default:
--quiet
,-q
- Only print output from the remote session. Default:
false
.
- Only print output from the remote session. Default:
--location
- The location associated with the workload deployment (e.g.,
aws-us-west-1
). Defaults to the first location fetched from the specified GVC. When specifying, make sure that the specified location is part of the specified GVC.
- The location associated with the workload deployment (e.g.,
--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 Usage
Retrieve Workload Deployments
This command lists available locations. Identify the location name from the output.
Usage
Example usage:
Advanced Usage
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
To override the output format, use the --output
option followed by the desired format (YAML, JSON, etc.).
Execute Within a Specific Replica
Example usage:
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:
Sending Stdin
To send stdin to a command executed within a workload, use the -i
or --stdin
option.
Example usage:
Starting an Interactive Session
To start an interactive session using the exec command, combine the -i
and -t
options (or use -it
). This allows you to run a shell command within a container interactively.
Example usage: