> ## Documentation Index
> Fetch the complete documentation index at: https://docs.controlplane.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Reference

> Comprehensive guide to the Control Plane CLI for managing infrastructure, workloads, and resources.

The Control Plane CLI (`cpln`) provides a powerful command-line interface for managing organizations, GVCs, workloads, and all supporting resources.

<Info>
  Nearly everything you can do through the Console UI, API, or Terraform can also be done through the CLI. The CLI also provides powerful operations not available elsewhere, such as port forwarding, executing commands in containers, and converting Kubernetes manifests.
</Info>

<Tip>
  Working with an AI assistant? The [Control Plane AI Plugin](/mcp/ai-plugin) teaches Claude Code, Codex, and Gemini CLI how to drive `cpln` correctly — including the resource command map, hallucination traps, and the multi-step workflows that the CLI doesn't bundle into single commands.
</Tip>

## Get started

<CardGroup cols={2}>
  <Card title="Installation" href="/cli-reference/installation" icon="download">
    Install via npm, Homebrew, or binary download
  </Card>

  <Card title="Quickstart" href="/cli-reference/get-started/quickstart" icon="rocket">
    Get up and running in minutes
  </Card>

  <Card title="Authentication" href="/cli-reference/get-started/authentication" icon="key">
    Log in with interactive or token-based flows
  </Card>

  <Card title="Profiles" href="/cli-reference/get-started/profiles" icon="user">
    Manage multiple environments and contexts
  </Card>
</CardGroup>

## Quick reference

<Steps>
  <Step title="Install the CLI">
    <Tabs>
      <Tab title="npm">
        ```bash theme={null}
        npm install -g @controlplane/cli
        ```
      </Tab>

      <Tab title="Homebrew">
        ```bash theme={null}
        brew tap controlplane-com/cpln && brew install cpln
        ```
      </Tab>

      <Tab title="Binary">
        Download from the [Installation page](/cli-reference/installation).
      </Tab>
    </Tabs>
  </Step>

  <Step title="Verify installation">
    ```bash theme={null}
    cpln --version
    ```
  </Step>

  <Step title="Authenticate">
    ```bash theme={null}
    cpln login
    ```

    For browser-less environments, see [Authentication](/cli-reference/get-started/authentication).
  </Step>

  <Step title="Explore commands">
    ```bash theme={null}
    cpln --help
    cpln <command> --help
    ```

    Browse all commands in the **Commands** section.
  </Step>
</Steps>

## Using the CLI

<CardGroup cols={2}>
  <Card title="Getting Help" href="/cli-reference/using-cli/help" icon="circle-question">
    Use built-in help to discover commands and flags
  </Card>

  <Card title="Common Options" href="/cli-reference/using-cli/common-options" icon="sliders">
    Shared flags across all CLI commands
  </Card>

  <Card title="Output Formats" href="/cli-reference/using-cli/output" icon="code">
    Control command output with JSON, YAML, and more
  </Card>

  <Card title="Troubleshooting" href="/cli-reference/using-cli/troubleshooting" icon="wrench">
    Common issues and solutions
  </Card>

  <Card title="Shell Completion" href="/cli-reference/using-cli/shell-completion" icon="wand-magic-sparkles">
    Enable tab completion for commands and flags
  </Card>

  <Card title="Common Workflows" href="#common-workflows" icon="clipboard-list">
    Deploy apps, manage secrets, debug workloads, and more
  </Card>
</CardGroup>

## CI/CD & automation

<CardGroup cols={2}>
  <Card title="CI/CD Usage" href="/cli-reference/ci-cd-development/ci-cd" icon="code">
    Automate deployments with service accounts
  </Card>

  <Card title="Container Images" href="/cli-reference/ci-cd-development/container-image" icon="docker">
    Run the CLI inside Docker containers
  </Card>
</CardGroup>

## CLI-only features

These operations are unique to the CLI and provide capabilities not available in the Console or API:

<CardGroup cols={2}>
  <Card title="cpln apply / delete" href="/guides/cpln-apply" icon="upload">
    GitOps-style resource management from YAML/JSON files
  </Card>

  <Card title="cpln convert" href="/guides/cli/cpln-convert" icon="arrows-rotate">
    Convert Kubernetes manifests to Control Plane format
  </Card>

  <Card title="cpln helm" href="/guides/cpln-helm" icon="ship">
    Deploy Helm charts directly to Control Plane
  </Card>

  <Card title="cpln stack" href="/guides/compose-deploy" icon="docker">
    Deploy Docker Compose applications to Control Plane
  </Card>

  <Card title="cpln operator" href="/guides/cli/cpln-operator" icon="dharmachakra">
    Manage the Kubernetes operator for Control Plane
  </Card>

  <Card title="cpln port-forward" href="/guides/cli/cpln-port-forward" icon="right-left">
    Forward local ports to workloads for debugging
  </Card>

  <Card title="cpln cp" href="/guides/cli/cpln-cp" icon="copy">
    Copy files to and from workload containers
  </Card>

  <Card title="cpln workload exec" href="/guides/cli/workload/exec" icon="terminal">
    Execute commands inside running containers
  </Card>

  <Card title="cpln workload connect" href="/guides/cli/workload/connect" icon="square-terminal">
    Open an interactive shell in a workload container
  </Card>

  <Card title="cpln image push" href="/guides/push-image" icon="arrow-up-from-bracket">
    Push images to Control Plane registry
  </Card>

  <Card title="docker pull" href="/guides/pull-image" icon="arrow-down-to-bracket">
    Pull images from Control Plane registry
  </Card>

  <Card title="cpln image copy" href="/guides/copy-image" icon="clone">
    Copy images between registries or orgs
  </Card>
</CardGroup>

<Tip>
  Dive into all CLI-only features in the **Guides** section for detailed walkthroughs and examples.
</Tip>

## Common workflows

Learn by example with these common CLI workflows:

<Note>
  These examples assume you have a [profile configured](/cli-reference/get-started/profiles) with a default org set.
</Note>

<AccordionGroup>
  <Accordion title="Deploy an application">
    <Tabs>
      <Tab title="Local application">
        Build and push your local application to Control Plane's image registry:

        ```bash bash theme={null}
        # Create a GVC
        cpln gvc create --name my-app-gvc --location aws-us-east-1

        # Build and push your image
        cpln image build --name my-app:v1.0.0 --push

        # Create a workload using your image
        cpln workload create \
          --name my-app \
          --gvc my-app-gvc \
          --image //image/my-app:v1.0.0 \
          --port 8080 \
          --public

        # View workload status
        cpln workload get my-app --gvc my-app-gvc
        ```

        <Warning>
          The `--port 8080` must match the port your application exposes in its Dockerfile. Change this value to match your application's exposed port.
        </Warning>
      </Tab>

      <Tab title="Public image">
        Deploy using a public image from Docker Hub or another registry:

        ```bash bash theme={null}
        # Create a GVC
        cpln gvc create --name my-app-gvc --location aws-us-east-1

        # Create a workload with a public image
        cpln workload create \
          --name my-app \
          --gvc my-app-gvc \
          --image nginx:latest \
          --port 80 \
          --public

        # View workload status
        cpln workload get my-app --gvc my-app-gvc
        ```
      </Tab>
    </Tabs>

    See [Create Workload](/cli-reference/commands/workload#workload-create) for detailed steps.
  </Accordion>

  <Accordion title="GitOps with cpln apply">
    ```bash bash theme={null}
    # Export existing resources
    cpln gvc get my-gvc --output yaml-slim > gvc.yaml
    cpln workload get my-app --gvc my-gvc --output yaml-slim > workload.yaml

    # Edit files, then apply
    cpln apply --file gvc.yaml
    cpln apply --file workload.yaml --gvc my-gvc
    ```

    See [cpln apply](/guides/cpln-apply) for GitOps workflows.
  </Accordion>

  <Accordion title="Manage secrets and identities">
    Create a secret, grant a workload identity access to it via a policy, and inject it as an environment variable.

    ```bash bash theme={null}
    # Create a file containing the secret value
    echo "hello-world" > my-db-password.txt

    # Create an opaque secret from the file
    cpln secret create-opaque --name db-password \
      --encoding plain \
      --file my-db-password.txt

    # Create a GVC
    cpln gvc create --name my-gvc --location aws-us-east-1

    # Create an identity for your workload
    cpln identity create --name my-app-identity --gvc my-gvc

    # Create a policy targeting the secret
    cpln policy create --name my-app-secrets-policy \
      --target-kind secret \
      --resource db-password

    # Add a binding to grant the identity reveal permission
    cpln policy add-binding my-app-secrets-policy \
      --identity //gvc/my-gvc/identity/my-app-identity \
      --permission reveal

    # Create a workload with the identity attached and inject the secret as an env var
    cpln workload create \
      --name my-app \
      --gvc my-gvc \
      --image nginx:latest \
      --port 80 \
      --identity my-app-identity \
      --env DB_PASSWORD=cpln://secret/db-password.payload \
      --public

    # Check workload status (and wait for the workload to become ready)
    cpln workload get my-app --gvc my-gvc

    # Verify the secret is available in the container
    cpln workload exec my-app --gvc my-gvc -- env | grep DB_PASSWORD

    # Expected output from the cpln workload exec command
    Defaulting to location 'aws-us-east-1' because no location was specified in the command.
    Defaulting to replica 'my-app-00001-deployment-6d67547b5d-586d9' because no replica was specified in the command.
    Defaulting to container 'nginx' because no container was specified in the command.
    DB_PASSWORD=hello-world
    ```

    See [Policy](/reference/policy) for access control.
  </Accordion>

  <Accordion title="Build and push images">
    ```bash bash theme={null}
    # Build and push
    cpln image build --name my-app:v1.0.0 --push

    # Update workload to use new image (replace <container-name>
    # with the acutal container name from your workload)
    cpln workload update my-app --gvc my-gvc \
      --set spec.containers.<container-name>.image=//image/my-app:v1.0.0
    ```

    See [Push Image](/guides/push-image) for details.
  </Accordion>

  <Accordion title="Debug a workload">
    ```bash theme={null}
    # View logs
    cpln logs '{gvc="my-gvc", workload="my-app"}'

    # Execute commands in a container
    cpln workload exec my-app --gvc my-gvc -- ls -a

    # Forward a port for local testing
    cpln port-forward my-app 8080:8080 --gvc my-gvc

    # Copy files from a workload (assuming your workload is using nginx:latest image)
    cpln cp my-app:usr/share/nginx/html/index.html ./index.html --gvc my-gvc
    ```

    See [Workload Exec](/guides/cli/workload/exec) and [Port Forward](/guides/cli/cpln-port-forward).
  </Accordion>
</AccordionGroup>

## Command categories

The CLI organizes commands by resource type. Explore the **Commands** section for detailed reference on each command.

### Infrastructure

<CardGroup cols={3}>
  <Card title="gvc" href="/cli-reference/commands/gvc" icon="network-wired">
    Global Virtual Clouds
  </Card>

  <Card title="location" href="/cli-reference/commands/location" icon="globe">
    Available locations
  </Card>

  <Card title="org" href="/cli-reference/commands/org" icon="building">
    Organizations
  </Card>
</CardGroup>

### Workloads & compute

<CardGroup cols={3}>
  <Card title="workload" href="/cli-reference/commands/workload" icon="server">
    Manage workloads
  </Card>

  <Card title="mk8s" href="/cli-reference/commands/mk8s" icon="dharmachakra">
    Managed Kubernetes
  </Card>

  <Card title="volumeset" href="/cli-reference/commands/volumeset" icon="database">
    Persistent volumes
  </Card>
</CardGroup>

### Images & containers

<CardGroup cols={3}>
  <Card title="image" href="/cli-reference/commands/image" icon="docker">
    Container images
  </Card>

  <Card title="stack" href="/cli-reference/commands/stack" icon="layer-group">
    Docker Compose stacks
  </Card>
</CardGroup>

### Security & access

<CardGroup cols={3}>
  <Card title="secret" href="/cli-reference/commands/secret" icon="key">
    Secrets management
  </Card>

  <Card title="policy" href="/cli-reference/commands/policy" icon="shield">
    Access policies
  </Card>

  <Card title="identity" href="/cli-reference/commands/identity" icon="fingerprint">
    Workload identities
  </Card>
</CardGroup>

### Users & accounts

<CardGroup cols={3}>
  <Card title="user" href="/cli-reference/commands/user" icon="user">
    User accounts
  </Card>

  <Card title="group" href="/cli-reference/commands/group" icon="users">
    User groups
  </Card>

  <Card title="serviceaccount" href="/cli-reference/commands/serviceaccount" icon="robot">
    Service accounts
  </Card>
</CardGroup>

### Networking & domains

<CardGroup cols={3}>
  <Card title="domain" href="/cli-reference/commands/domain" icon="globe">
    Custom domains
  </Card>

  <Card title="ipset" href="/cli-reference/commands/ipset" icon="list-ol">
    IP sets for firewall rules
  </Card>
</CardGroup>

### Infrastructure as code

<CardGroup cols={3}>
  <Card title="apply" href="/cli-reference/commands/apply" icon="upload">
    Create/update from files
  </Card>

  <Card title="delete" href="/cli-reference/commands/delete" icon="trash">
    Delete from files
  </Card>

  <Card title="convert" href="/cli-reference/commands/convert" icon="arrows-rotate">
    Convert K8s to Control Plane
  </Card>
</CardGroup>

### Operations & utilities

<CardGroup cols={3}>
  <Card title="logs" href="/cli-reference/commands/logs" icon="file-lines">
    View logs
  </Card>

  <Card title="port-forward" href="/cli-reference/commands/port-forward" icon="right-left">
    Forward ports to workloads
  </Card>

  <Card title="cp" href="/cli-reference/commands/cp" icon="copy">
    Copy files to/from workloads
  </Card>

  <Card title="helm" href="/cli-reference/commands/helm" icon="ship">
    Manage Helm releases
  </Card>
</CardGroup>

### Cloud & integrations

<CardGroup cols={3}>
  <Card title="cloudaccount" href="/cli-reference/commands/cloudaccount" icon="cloud">
    Cloud provider accounts
  </Card>

  <Card title="agent" href="/cli-reference/commands/agent" icon="tower-broadcast">
    Control Plane agents
  </Card>

  <Card title="auditctx" href="/cli-reference/commands/auditctx" icon="clipboard-check">
    Audit contexts
  </Card>
</CardGroup>

### System & admin

<CardGroup cols={3}>
  <Card title="profile" href="/cli-reference/commands/profile" icon="address-card">
    CLI profiles
  </Card>

  <Card title="login" href="/cli-reference/commands/login" icon="right-to-bracket">
    Authentication
  </Card>

  <Card title="quota" href="/cli-reference/commands/quota" icon="gauge">
    Resource quotas
  </Card>

  <Card title="task" href="/cli-reference/commands/task" icon="list-check">
    Pending tasks
  </Card>

  <Card title="misc" href="/cli-reference/commands/misc" icon="ellipsis">
    Miscellaneous utilities
  </Card>

  <Card title="rest" href="/cli-reference/commands/rest" icon="code">
    Direct REST API access
  </Card>
</CardGroup>

## Additional resources

<CardGroup cols={2}>
  <Card title="API Reference" href="/api-reference/api" icon="code">
    REST API documentation
  </Card>

  <Card title="Concepts" href="/concepts/org" icon="lightbulb">
    Core platform concepts
  </Card>

  <Card title="Terraform Provider" href="/iac/terraform" icon="file-code">
    Infrastructure as code with Terraform
  </Card>
</CardGroup>

## Get help

<CardGroup cols={2}>
  <Card title="Built-in Help" href="/cli-reference/using-cli/help" icon="circle-question">
    Use `cpln --help` to explore commands
  </Card>

  <Card title="Troubleshooting" href="/cli-reference/using-cli/troubleshooting" icon="wrench">
    Solutions to common issues
  </Card>
</CardGroup>
