# Chalk CLI Reference: Infrastructure
source: https://docs.chalk.ai/cli#infrastructure

Manage and inspect Chalk-managed infrastructure — apply, describe, migrate, suspend, resume, and view stats for control-plane components such as the gateway, metrics, persistence, and telemetry.

## `chalk infra describe`
source: https://docs.chalk.ai/cli?command=infra_describe

```bash
chalk infra describe
```

Describe various Chalk infrastructure components.

## `chalk infra describe metrics`
source: https://docs.chalk.ai/cli?command=infra_describe_metrics

```bash
chalk infra describe metrics
```

Use this to show the current configuration of the metrics database attached to this environment. This includes variables in the postgres configuration, as well as the connection pool for the database.

**Example**

```
$ chalk infra describe metrics

backup_bucket: s3://chalk-metrics-backup-bucket
backup_iam_role_arn: arn:aws:iam::123456789012:role/chalk-metrics-backup
connection_pool_max_connections: "1000"
connection_pool_replicas: 3
connection_pool_size: "50"
database_name: chalk-metrics
database_replicas: 1
limit:
    cpu: "1"
    memory: 1000Mi
namespace: chalk-metrics
postgres_parameters:
    max_connections: "300"
request:
    cpu: "1"
    memory: 1000Mi
secret_name: chalk-metrics-uri
storage: 200Gi
timescale_image: ghcr.io/imusmanmalik/timescaledb-postgis:16-3.4-54
```

## `chalk infra describe persistence`
source: https://docs.chalk.ai/cli?command=infra_describe_persistence

```bash
chalk infra describe persistence
```

Use this to show the current configuration of the background persistence attached to this environment. This includes the topics used, and the various writers that are enabled.

**Example**

```
$ chalk infra describe persistence

api_server_host: https://api.chalk.ai
common_persistence_specs:
    bigquery_parquet_upload_subscription_id: offline-store-bulk-insert-bus-1
    bigquery_streaming_write_subscription_id: offline-store-streaming-insert-bus-1
    bigquery_streaming_write_topic: offline-store-streaming-insert-bus-1
    bigquery_upload_bucket: s3://data-bucket
    bigquery_upload_topic: offline-store-bulk-insert-bus-1
    bus_backend: KAFKA
    bus_writer_image_go: 012345678901.dkr.ecr.us-east-1.amazonaws.com/writer-go:latest
    bus_writer_image_python: 012345678901.dkr.ecr.us-east-1.amazonaws.com/engine-base:latest
    kafka_dlq_topic: dlq-1
    metrics_bus_subscription_id: metrics-bus-1
    metrics_bus_topic_id: metrics-bus-1
    namespace: ns-chalk
    operation_subscription_id: operation-bus-1
    result_bus_metrics_subscription_id: result-bus-1
    result_bus_offline_store_subscription_id: result-bus-1
    result_bus_online_store_subscription_id: result-bus-1
    result_bus_topic_id: result-bus-1
    secret_client: AWS
    service_account_name: persistence-workload-identity
kafka_bootstrap_servers: b-2.random.kafka.us-east-1.amazonaws.com:9096,b-1.random.kafka.us-east-1.amazonaws.com:9096,b-3.random.kafka.us-east-1.amazonaws.com:9096
kafka_sasl_mechanism: SCRAM-SHA-512
kafka_sasl_secret: AmazonMSK_chalk
kafka_security_protocol: SASL_SSL
metadata_provider: GRPC_SERVER
redis_is_clustered: "1"
writers:
    - bus_subscriber_type: GO_METRICS_BUS_WRITER
      default_replica_count: 1
      hpa_specs:
        hpa_max_replicas: 1
      limit:
        cpu: "1"
        memory: 512Mi
      name: go-metrics-bus-writer
      request:
        cpu: 200m
        memory: 512Mi
      version: latest
    - bus_subscriber_type: GO_RESULT_BUS_METRICS_WRITER
      default_replica_count: 1
      hpa_specs:
        hpa_max_replicas: 1
      limit:
        cpu: "1"
        memory: 1024Mi
      name: go-result-bus-metrics-writer
      request:
        cpu: 400m
        memory: 1024Mi
      version: latest
    - bus_subscriber_type: CLUSTER_MANAGER
      default_replica_count: 1
      limit:
        cpu: 100m
        memory: 200Mi
      name: cluster-manager
      request:
        cpu: 100m
        memory: 200Mi
      version: latest
```

## `chalk infra describe gateway`
source: https://docs.chalk.ai/cli?command=infra_describe_gateway

```bash
chalk infra describe gateway
```

Use this to show the current configuration of the Envoy gateway attached to this environment.

**Example**

```
$ chalk infra describe gateway

gateway_class_name: chalk-class
gateway_name: chalk
listeners:
    - allowed_routes:
        namespaces:
            from: All
      name: http
      port: 80
      protocol: HTTP
namespace: chalk-envoy
```

## `chalk infra describe kafka_topics`
source: https://docs.chalk.ai/cli?command=infra_describe_kafka_topics

```bash
chalk infra describe kafka-topics
```

Use this to get the kafka topics for the environment.

**Example**

```
$ chalk infra describe kafka-topics

topics:
    - name: dev-null
      partitions: 1
      replication: 1
      retention_ms: 1.728e+08
    - name: dlq-1
      partitions: 6
      replication: 3
      retention_ms: 1.728e+08
    - name: metrics-bus-1
      partitions: 6
      replication: 3
      retention_ms: 1.728e+08
    - name: offline-store-bulk-insert-bus-1
      partitions: 6
      replication: 3
      retention_ms: 1.728e+08
    - name: offline-store-streaming-insert-bus-1
      partitions: 6
      replication: 3
      retention_ms: 1.728e+08
    - name: operation-bus-1
      partitions: 6
      replication: 3
      retention_ms: 1.728e+08
    - name: result-bus-1
      partitions: 6
      replication: 3
      retention_ms: 1.728e+08
```

## `chalk infra describe volumes`
source: https://docs.chalk.ai/cli?command=infra_describe_volumes

```bash
chalk infra describe volumes
```

Use this to show the current configuration of the persistent volumes attached to this environment. This includes the storage class, size, and access mode of the volumes, as well as point in time metrics.

**Example**

```
$ chalk infra describe volumes
volumes:
    - metrics:
        available_bytes: 3.14101747712e+11
        capacity_bytes: 3.15927166976e+11
        used_bytes: 1.808642048e+09
      spec:
        access_modes:
            - ReadWriteOnce
        capacity: 300Gi
        claim: chalk-metrics-1
        name: pvc-9a361e14-b2d1-4a42-8c19-95ed0583eb3c
        reclaim_policy: Delete
        storage_class: ebs-csi-default-sc
```

## `chalk infra describe telemetry`
source: https://docs.chalk.ai/cli?command=infra_describe_telemetry

```bash
chalk infra describe telemetry [namespace]
```

Use this to show the current configuration of the telemetry deployment attached to the namespace. This includes the clickhouse database and the otel collector. If namespace is not specified, the cluster level spec will be provided

**Example**

```
$ chalk infra describe telemetry [namespace]
```

## `chalk infra apply`
source: https://docs.chalk.ai/cli?command=infra_apply

```bash
chalk infra apply
```

Upgrade the schema of Chalk managed control plane infrastructure

## `chalk infra apply metrics`
source: https://docs.chalk.ai/cli?command=infra_apply_metrics

```bash
chalk infra apply metrics [flags]
```

Create or update the metrics db hosted in the kubernetes cluster attached to this environment.

If no db exists, use --file to create one. If a db exists, update it using individual flags or --file.

This would be commonly used to upsize the disk, change the connection pool parameters, or update the postgres config. Please note that some changes can cause downtime, and to plan accordingly.

**Flags**

- `-f, --file <file>` (string)
  Path to a JSON file containing infrastructure configuration values.
- `--storage <storage>` (string)
  Storage size for the metrics database (for example, `100Gi`). See [Kubernetes resource units](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-units-in-kubernetes).
- `--replicas <replicas>` (int, default `0`)
  Replica count for the metrics database.
- `--connection-pool-size <connection-pool-size>` (string)
  Connection pool size for the metrics database.
- `--connection-pool-max-connections <connection-pool-max-connections>` (string)
  Maximum allowed connections for the metrics database connection pool.
- `--connection-pool-replicas <connection-pool-replicas>` (int, default `0`)
  Replica count for the metrics database connection pool.

**Example**

```
$ chalk infra apply metrics --replicas 1

Changes to spec:
@ ["database_replicas"]
- 2
+ 1


  Apply changes?  Yes

Metrics spec update applied.
```

## `chalk infra apply persistence`
source: https://docs.chalk.ai/cli?command=infra_apply_persistence

```bash
chalk infra apply persistence
```

Use this to create or update the background persistence configuration hosted in the kubernetes cluster attached to this environment.

**Flags**

- `-f, --file <file>` (string)
  Path to a JSON file containing infrastructure configuration values.

**Example**

```
chalk infra apply persistence -f persistence.yaml

Changes to spec:
@ ["writers",1,"default_replica_count"]
- 1
+ 2
@ ["writers",1,"hpa_specs","hpa_max_replicas"]
- 1
+ 2

 
  Apply changes?  Yes
 
Persistence spec update applied.
```

## `chalk infra apply gateway`
source: https://docs.chalk.ai/cli?command=infra_apply_gateway

```bash
chalk infra apply gateway
```

Use this to show the create or update the configuration of the Envoy gateway attached to this environment.

**Flags**

- `-f, --file <file>` (string)
  Path to a JSON file containing infrastructure configuration values.

**Example**

```
$ chalk infra apply gateway -f gateway.yaml

Changes to spec:
@ ["listeners",0,"port"]
- 80
+ 8080

  Apply changes?  Yes
 
Gateway spec update applied
```

## `chalk infra apply kafka_topics`
source: https://docs.chalk.ai/cli?command=infra_apply_kafka_topics

```bash
chalk infra apply kafka-topics
```

Use this to create or update the kafka topics for the environment.

**Flags**

- `-f, --file <file>` (string)
  Path to a JSON file containing infrastructure configuration values.

**Example**

```
$ chalk infra apply kafka-topics -f topics.yaml

To create/update:

topics:
    - name: chalk-topic-0
      partitions: 1
      replication: 1
      retention_ms: 1.728e+08
    - name: chalk-topic-1
      partitions: 6
      replication: 3
      retention_ms: 1.728e+08


  Apply changes?  Yes

Topics created/updated.
```

## `chalk infra apply telemetry`
source: https://docs.chalk.ai/cli?command=infra_apply_telemetry

```bash
chalk infra apply telemetry
```

Use this to create or update the telemetry configuration hosted in the kubernetes cluster attached to this environment.

**Flags**

- `-f, --file <file>` (string)
  Path to a JSON file containing infrastructure configuration values.
- `-c, --customer-collector-config-file <customer-collector-config-file>` (string)
  Path to a YAML file containing customer OpenTelemetry collector configuration.

**Example**

```
chalk infra apply telemetry -f telemetry.yaml

Changes to spec:
@ ["click_house"]
- {"click_house_version":"head","limit":{"cpu":"2","memory":"4Gi"},"request":{"cpu":"1","memory":"2Gi"}}
@ ["namespace"]
- "default"
+ "my-new-namespace"
@ ["otel"]
- {"limit":{"cpu":"500m","memory":"512Mi"},"otel_collector_version":"latest","request":{"cpu":"100m","memory":"256Mi"}}


 Apply changes?  Yes

Telemetry spec update applied.
```

## `chalk infra migrate`
source: https://docs.chalk.ai/cli?command=infra_migrate

```bash
chalk infra migrate
```

Migrate the schema of chalk control plane components.

## `chalk infra migrate metrics`
source: https://docs.chalk.ai/cli?command=infra_migrate_metrics

```bash
chalk infra migrate metrics
```

Use this to upgrade the schema of your metrics db to be current with your deployment version.

**Example**

```
$ chalk infra migrate metrics
Migration applied.
```

## `chalk infra stats`
source: https://docs.chalk.ai/cli?command=infra_stats

```bash
chalk infra stats
```

Get the stats for the infrastructure.

## `chalk infra stats metrics`
source: https://docs.chalk.ai/cli?command=infra_stats_metrics

```bash
chalk infra stats metrics
```

Use this to get the prometheus metrics of the metrics db in the cluster.

**Example**

```
$ chalk infra stats metrics
cnpg_pg_settings_setting{name="shared_memory_size",pod="chalk-metrics-1",namespace="chalk-metrics"} 151
cnpg_pg_settings_setting{name="shared_memory_size_in_huge_pages",pod="chalk-metrics-1",namespace="chalk-metrics"} 76
cnpg_pg_settings_setting{name="ssl",pod="chalk-metrics-1",namespace="chalk-metrics"} 1
cnpg_pg_settings_setting{name="ssl_passphrase_command_supports_reload",pod="chalk-metrics-1",namespace="chalk-metrics"} 0
cnpg_pg_settings_setting{name="ssl_prefer_server_ciphers",pod="chalk-metrics-1",namespace="chalk-metrics"} 1
cnpg_pg_settings_setting{name="standard_conforming_strings",pod="chalk-metrics-1",namespace="chalk-metrics"} 1
cnpg_pg_settings_setting{name="statement_timeout",pod="chalk-metrics-1",namespace="chalk-metrics"} 0
cnpg_pg_settings_setting{name="superuser_reserved_connections",pod="chalk-metrics-1",namespace="chalk-metrics"} 3
cnpg_pg_settings_setting{name="synchronize_seqscans",pod="chalk-metrics-1",namespace="chalk-metrics"} 1
cnpg_pg_settings_setting{name="syslog_sequence_numbers",pod="chalk-metrics-1",namespace="chalk-metrics"} 1
cnpg_pg_settings_setting{name="syslog_split_messages",pod="chalk-metrics-1",namespace="chalk-metrics"} 1
cnpg_pg_settings_setting{name="tcp_keepalives_count",pod="chalk-metrics-1",namespace="chalk-metrics"} 0
cnpg_pg_settings_setting{name="tcp_keepalives_idle",pod="chalk-metrics-1",namespace="chalk-metrics"} 0
cnpg_pg_settings_setting{name="tcp_keepalives_interval",pod="chalk-metrics-1",namespace="chalk-metrics"} 0
cnpg_pg_settings_setting{name="tcp_user_timeout",pod="chalk-metrics-1",namespace="chalk-metrics"} 0
...
```

## `chalk infra stats gateway`
source: https://docs.chalk.ai/cli?command=infra_stats_gateway

```bash
chalk infra stats gateway
```

Use this to get the prometheus metrics of the envoy gateway and controller in this cluster.

**Example**

```
$ chalk infra stats gateway
# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations. Equals to /memory/classes/other:bytes.
# TYPE go_memstats_other_sys_bytes gauge
go_memstats_other_sys_bytes{pod="envoy-gateway-7c9f7c97db-frnc4",namespace="chalk-envoy"} 607573
# HELP go_memstats_frees_total Total number of heap objects frees. Equals to /gc/heap/frees:objects + /gc/heap/tiny/allocs:objects.
# TYPE go_memstats_frees_total counter
go_memstats_frees_total{pod="envoy-gateway-7c9f7c97db-frnc4",namespace="chalk-envoy"} 8.426932732e+09
# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes + /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes.
# TYPE go_memstats_heap_sys_bytes gauge
go_memstats_heap_sys_bytes{pod="envoy-gateway-7c9f7c97db-frnc4",namespace="chalk-envoy"} 1.1485184e+08
# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used. Equals to /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes.
# TYPE go_memstats_heap_idle_bytes gauge
go_memstats_heap_idle_bytes{pod="envoy-gateway-7c9f7c97db-frnc4",namespace="chalk-envoy"} 3.3570816e+07
# HELP rest_client_requests_total Number of HTTP requests, partitioned by status code, method, and host.
# TYPE rest_client_requests_total counter
...
```

## `chalk infra stats volumes`
source: https://docs.chalk.ai/cli?command=infra_stats_volumes

```bash
chalk infra stats volumes
```

Use this to get the kubelet prometheus metrics of the persistent volumes in the cluster.

**Example**

```
$ chalk infra stats volumes
# HELP kubelet_volume_stats_capacity_bytes [ALPHA] Capacity in bytes of the volume
# TYPE kubelet_volume_stats_capacity_bytes gauge
kubelet_volume_stats_capacity_bytes{namespace="chalk-metrics",persistentvolumeclaim="chalk-metrics-1",node="ip-10-146-75-140.ec2.internal"} 3.15927166976e+11
# HELP kubelet_volume_stats_inodes [ALPHA] Maximum number of inodes in the volume
# TYPE kubelet_volume_stats_inodes gauge
kubelet_volume_stats_inodes{namespace="chalk-metrics",persistentvolumeclaim="chalk-metrics-1",node="ip-10-146-75-140.ec2.internal"} 1.96608e+07
...
```

## `chalk infra suspend`
source: https://docs.chalk.ai/cli?command=infra_suspend

```bash
chalk infra suspend
```

Suspend part of the infrastructure.

## `chalk infra suspend telemetry`
source: https://docs.chalk.ai/cli?command=infra_suspend_telemetry

```bash
chalk infra suspend telemetry
```

Use this to suspend the telemetry deployment attached to this environment. This will stop tracing for all environments that also use this telemetry deployment.

## `chalk infra suspend gateway`
source: https://docs.chalk.ai/cli?command=infra_suspend_gateway

```bash
chalk infra suspend gateway
```

Use this to suspend the Envoy gateway attached to this environment. This will scale the gateway to zero replicas, stopping all ingress traffic through the gateway.

**Example**

```
$ chalk infra suspend gateway

  Suspend the gateway?  Yes

Gateway successfully suspended.
```

## `chalk infra suspend persistence`
source: https://docs.chalk.ai/cli?command=infra_suspend_persistence

```bash
chalk infra suspend persistence
```

Use this to suspend the background persistence attached to this environment. This will scale all persistence writers to zero replicas, stopping all background data persistence operations.

**Example**

```
$ chalk infra suspend persistence

  Suspend background persistence?  Yes

Persistence successfully suspended.
```

## `chalk infra resume`
source: https://docs.chalk.ai/cli?command=infra_resume

```bash
chalk infra resume
```

Resume a suspended part of the infrastructure.

## `chalk infra resume telemetry`
source: https://docs.chalk.ai/cli?command=infra_resume_telemetry

```bash
chalk infra resume telemetry
```

Use this to resume the telemetry deployment attached to this environment. This will restart tracing for all environments that also use this telemetry deployment. You may need to do a new chalk deploy to have tracing data show up again.

## `chalk infra resume gateway`
source: https://docs.chalk.ai/cli?command=infra_resume_gateway

```bash
chalk infra resume gateway
```

Use this to resume the Envoy gateway attached to this environment. This will restore the gateway to its configured replica count, allowing ingress traffic through the gateway again.

**Example**

```
$ chalk infra resume gateway

  Resume the gateway?  Yes

Gateway successfully resumed.
```

## `chalk infra resume persistence`
source: https://docs.chalk.ai/cli?command=infra_resume_persistence

```bash
chalk infra resume persistence
```

Use this to resume the background persistence attached to this environment. This will restore all persistence writers to their configured replica counts, allowing background data persistence operations to continue.

**Example**

```
$ chalk infra resume persistence

  Resume background persistence?  Yes

Persistence successfully resumed.
```
