# Chalk CLI Reference: Scaling Groups
source: https://docs.chalk.ai/cli#scaling-groups

Create and manage scaling groups (K8s Deployments with replicas) in your Chalk Kubernetes cluster.

## `chalk scaling-group create`
source: https://docs.chalk.ai/cli?command=scaling_group_create

```bash
chalk scaling-group create
```

Use the 'chalk scaling-group create' command to create a stable scaling group.

The scaling group will run in your Chalk environment's Kubernetes cluster with the specified image and scaling configuration. You can optionally expose a port, configure min and max replicas for autoscaling, and enable scale-to-zero by setting --min-replicas=0. Requests return an error while scaling from zero by default; set --scale-from-zero-request-policy=hold to hold and retry them instead.

**Flags**

- `-i, --image <image>` (string)
  Docker image to run.
- `--compute-class <compute-class>` (string, default `k8s`)
  Where to run the container: `k8s` (default, run as a Kubernetes pod) or `host` (a Chalk Compute host).
- `--execution-target <execution-target>` (string)
  Where to place the workload: `environment` or `serverless`.
- `-n, --name <name>` (string)
  Unique name for the scaling group.
- `-e, --entrypoint <entrypoint>` (string)
  Entrypoint command and arguments (comma-separated).
- `-t, --tags <tags>` (string)
  User-defined tags as `key=value` pairs (comma-separated).
- `--port <port>` (int, default `0`)
  Optional port to expose over HTTPS.
- `-r, --min-replicas <min-replicas>` (int, default `1`)
  Minimum number of replicas (0 for scale-to-zero).
- `--max-replicas <max-replicas>` (int, default `0`)
  Maximum number of replicas.
- `--scale-from-zero-request-policy <scale-from-zero-request-policy>` (string, default `error`)
  How requests are handled while scaling from zero: `error` or `hold`.
- `--target-cpu <target-cpu>` (int, default `0`)
  Target CPU utilization percentage for autoscaling (optional).
- `--cpu <cpu>` (string)
  CPU limit (e.g., `'2'` or `'500m'`).
- `--memory <memory>` (string)
  Memory limit (e.g., `'4Gi'` or `'512Mi'`).
- `--gpu <gpu>` (string)
  GPU request as `type:count` (e.g., `'nvidia-tesla-t4:1'`) or just `count` (e.g., `'1'`).
- `--grpc <grpc>` (bool, default `false`)
  Use gRPC as the backend protocol instead of HTTP.
- `--internal <internal>` (bool, default `false`)
  Use private routing (not publicly accessible).
- `--authenticated <authenticated>` (bool, default `false`)
  Require JWT authentication on the scaling group's HTTP route.
- `--chalk-identity <chalk-identity>` (bool, default `false`)
  Inject Chalk workload identity credentials into the scaling group.
- `--startup-probe <startup-probe>` (bool, default `false`)
  Wait for the externally routed HTTP or gRPC endpoint to respond before reporting the scaling group as Available.
- `--no-traffic <no-traffic>` (bool, default `false`)
  When updating an existing scaling group, preserve 100% traffic on its currently selected revision.
- `--env <env>` (string[], default `[]`)
  Environment variable as `KEY=VALUE`. Can be specified multiple times.
- `--env-file <env-file>` (string)
  Path to an env file containing environment variables (one `KEY=VALUE` per line).
- `--secret <secret>` (string[], default `[]`)
  Name of a stored secret to inject as env vars (or `integration:NAME[:KEY1,KEY2]` for an integration). Can be specified multiple times.
- `--volume <volume>` (string[], default `[]`)
  Chalk Volume URI, optionally followed by `=/mount/path`. Defaults to `/mnt/VOLUME`. Can be specified multiple times.
- `--empty-dir <empty-dir>` (string[], default `[]`)
  Ephemeral disk mount path, optionally followed by `=SIZE`. Defaults to the platform size limit. Can be specified multiple times.
- `--route <route>` (string[], default `[]`)
  Allowed outbound route as `CIDR[=PORT[,PORT-PORT,...]]`. Omitting ports allows all ports. Can be specified multiple times.
- `--host <host>` (string[], default `[]`)
  Allowed outbound host as `HOSTNAME`, such as `github.com`. Without --route, only the named hosts are reachable. Host compute class only. Can be specified multiple times.
- `--no-routes <no-routes>` (bool, default `false`)
  Allow no outbound routes, denying all egress. Host compute class only. Cannot be combined with --route.

**Example**

```
$ chalk scaling-group create --image=busybox:latest --name=my-worker --max-replicas=5 -e "sh,-c,while true; do date; sleep 60; done"
$ chalk scaling-group create --image=nginx:latest --name=my-nginx --port=80 --max-replicas=5
$ chalk scaling-group create -i python:3.9 -n my-app --port=8080 --min-replicas=1 --max-replicas=10 --cpu=2 --memory=4Gi
$ chalk scaling-group create -i myapp:v1 -n my-service --port=8000 --min-replicas=0 --max-replicas=5 --tags="env=test,version=1.0" -e "python,serve.py"
$ chalk scaling-group create -i my-ml-model:v1 -n gpu-inference --port=8080 --min-replicas=1 --max-replicas=3 --gpu=nvidia-tesla-t4:1
$ chalk scaling-group create -i nginx:latest -n my-nginx --port=80 --max-replicas=5 --startup-probe
$ chalk scaling-group create -i my-worker:v2 -n volume-worker --max-replicas=5 --volume chalk://my-data@v2
```

## `chalk scaling-group get`
source: https://docs.chalk.ai/cli?command=scaling_group_get

```bash
chalk scaling-group get
```

Use the 'chalk scaling-group get' command to retrieve the status of a specific scaling group by its ID or name.

This will show detailed information about the scaling group including its status, image, replicas, and creation time.

**Flags**

- `-i, --id <id>` (string)
  ID of the scaling group (mutually exclusive with --name).
- `-n, --name <name>` (string)
  Name of the scaling group (mutually exclusive with --id).

**Example**

```
$ chalk scaling-group get --id=550e8400-e29b-41d4-a716-446655440000
$ chalk scaling-group get --name=my-scaling-group
$ chalk scaling-group get -n my-scaling-group
```

## `chalk scaling-group list`
source: https://docs.chalk.ai/cli?command=scaling_group_list

```bash
chalk scaling-group list
```

Use the 'chalk scaling-group list' command to list all scaling groups in your Chalk environment.

This will show a table of all scaling groups with their ID, name, status, replicas, image, and other details.

**Example**

```
$ chalk scaling-group list
```

## `chalk scaling-group delete`
source: https://docs.chalk.ai/cli?command=scaling_group_delete

```bash
chalk scaling-group delete
```

Use the 'chalk scaling-group delete' command to delete a scaling group and its Kubernetes resources.

This will remove the Deployment and associated resources from the cluster.

**Flags**

- `-i, --id <id>` (string)
  ID of the scaling group to delete (mutually exclusive with --name).
- `-n, --name <name>` (string)
  Name of the scaling group to delete (mutually exclusive with --id).
- `-f, --force <force>` (bool, default `false`)
  Skip the confirmation prompt when the scaling group has an associated function that will also be deleted.

**Example**

```
$ chalk scaling-group delete --id=550e8400-e29b-41d4-a716-446655440000
$ chalk scaling-group delete --name=my-scaling-group
$ chalk scaling-group delete -n my-scaling-group
```

## `chalk scaling-group update_traffic`
source: https://docs.chalk.ai/cli?command=scaling_group_update_traffic

```bash
chalk scaling-group update-traffic
```

Use the 'chalk scaling-group update-traffic' command to route 100% of traffic to an immutable revision. This changes selection without creating a revision. The API currently supports one revision target at 100% traffic.

**Flags**

- `-i, --id <id>` (string)
  Stable scaling-group ID (mutually exclusive with --name).
- `-n, --name <name>` (string)
  Scaling-group name (mutually exclusive with --id).
- `--revision-id <revision-id>` (string)
  Immutable revision ID to select.

**Example**

```
$ chalk scaling-group update-traffic --id=sg_123 --revision-id=sgr_456
$ chalk scaling-group update-traffic --name=my-scaling-group --revision-id=sgr_456
```

## `chalk scaling-group revisions get`
source: https://docs.chalk.ai/cli?command=scaling_group_revisions_get

```bash
chalk scaling-group revisions get
```

Get an immutable scaling-group revision

**Flags**

- `-i, --id <id>` (string)
  Stable scaling-group ID (mutually exclusive with --name).
- `-n, --name <name>` (string)
  Scaling-group name (mutually exclusive with --id).
- `--revision-id <revision-id>` (string)
  Immutable scaling-group revision ID.

**Example**

```
$ chalk scaling-group revisions get --id=sg_123 --revision-id=sgr_456
$ chalk scaling-group revisions get --name=my-scaling-group --revision-id=sgr_456
```

## `chalk scaling-group revisions list`
source: https://docs.chalk.ai/cli?command=scaling_group_revisions_list

```bash
chalk scaling-group revisions list
```

List immutable revisions of a scaling group

**Flags**

- `-i, --id <id>` (string)
  Stable scaling-group ID (mutually exclusive with --name).
- `-n, --name <name>` (string)
  Scaling-group name (mutually exclusive with --id).
- `--limit <limit>` (int, default `0`)
  Maximum number of revisions to return.

**Example**

```
$ chalk scaling-group revisions list --id=sg_123
$ chalk scaling-group revisions list --name=my-scaling-group --limit=10
```
