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

Options

Required

  • --location
    • The location associated with the workload deployment (e.g., aws-us-west-1).
  • --
    • Command to execute on replica (e.g., echo hello world).

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

copy
cpln workload get-deployments WORKLOAD_NAME

This command lists available locations. Identify the location name from the output.

Execute

Example usage:

copy
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

copy
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:

copy
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:

copy
cpln workload exec WORKLOAD_NAME --location LOCATION --container CONTAINER_NAME -- COMMAND ARG1 ARG2
Copyright © 2024 Control Plane Corporation. All rights reserved. Revision 44e6d472
Contents