---
title: "Configure calicoq"
description: "Configure the CLI to connect to the Kubernetes API datastore."
product: "Calico Enterprise"
version: "3.21"
section: "Operations"
canonical_url: "https://docs.tigera.io/calico-enterprise/3.21/operations/clis/calicoq/configure/overview"
---

# Configure calicoq

Many `calicoq` commands require access to the Calico Enterprise datastore. In most circumstances, `calicoq` cannot achieve this connection by default. You can provide`calicoq` with the information it needs using either of the following.

1. **Configuration file**: by default, `calicoq` will look for a configuration file at `/etc/calico/calicoq.cfg`. You can override this using the `--config` option with commands that require datastore access. The file can be in either YAML or JSON format. It must be valid and readable by `calicoq`. A YAML example follows.

   ```yaml
   apiVersion: projectcalico.org/v3
   kind: CalicoAPIConfig
   metadata:
   spec:
     datastoreType: "kdd"
     ...
   ```

2. **Environment variables**: If `calicoq` cannot locate, read, or access a configuration file, it will check a specific set of environment variables.

See the section that corresponds to your [datastore type](https://docs.tigera.io/calico-enterprise/3.21/operations/clis.md) for a full set of options and examples.

> **SECONDARY:**
>
> When running
>
> `calicoq`
>
>  inside a container, any environment variables and configuration files must be passed to the container so they are available to the process inside. It can be useful to keep a running container (that sleeps) configured for your datastore, then it is possible to
>
> `exec`
>
>  into the container and have an already configured environment.
