# How-To Run Calicoctl Commands

## Problem

When you try running *calicoctl* commands from the master nodes, the following error is observed.

{% tabs %}
{% tab title="None" %}

```none
$ /opt/pf9/pf9-kube/bin/calicoctl get nodes
Failed to create Calico API client: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
```

{% endtab %}
{% endtabs %}

## Environment

* Platform9 Managed Kubernetes - All versions.
* Calico

## Procedure

1. Log in to a master node and export the following environment variables.

{% tabs %}
{% tab title="None" %}

```none
$ export CALICO_DATASTORE_TYPE=kubernetes
$ export KUBECONFIG=/etc/pf9/kube.d/kubeconfigs/admin.yaml
```

{% endtab %}
{% endtabs %}

2. Run the *calicoctl* commands.

{% tabs %}
{% tab title="None" %}

```none
$ /opt/pf9/pf9-kube/bin/calicoctl get nodes
NAME
172.20.4.215
172.20.4.220
172.20.4.251
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://platform9.com/kb/pmk/how-to/how-to-run-calicoctl-commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
