How-To Run Calicoctl Commands

Problem

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

$ /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

Environment

  • Platform9 Managed Kubernetes - All versions.

  • Calico

Procedure

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

$ export CALICO_DATASTORE_TYPE=kubernetes
$ export KUBECONFIG=/etc/pf9/kube.d/kubeconfigs/admin.yaml
  1. Run the calicoctl commands.

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

Last updated