Installing calicoctl
About installing calicoctl
calicoctl
allows you to create, read, update, and delete Calico objects
from the command line.
You can run calicoctl
on any host with network access to the
Calico datastore as either a binary or a container.
For step-by-step instructions, refer to the section that
corresponds to your desired deployment.
Installing calicoctl as a binary on a single host
-
Log into the host, open a terminal prompt, and navigate to the location where you want to install the binary.
Tip: Consider navigating to a location that’s in your
PATH
. For example,/usr/local/bin/
. -
Use the following command to download the
calicoctl
binary. -
Set the file to be executable.
Note: If the location of
calicoctl
is not already in yourPATH
, move the file to one that is or add its location to yourPATH
. This will allow you to invoke it without having to prepend its location.
Next step:
Configure calicoctl
to connect to your datastore.
Installing calicoctl as a container on a single host
To install calicoctl
as a container on a single host, log into the
target host and issue the following command.
Next step:
Configure calicoctl
to connect to your datastore.
Installing calicoctl as a Kubernetes pod
Use the YAML that matches your datastore type to deploy the calicoctl
container to your nodes.
-
etcd
Note: You can also view the YAML in a new tab.
-
Kubernetes API datastore
Note: You can also view the YAML in a new tab.
You can then run commands using kubectl as shown below.
An example response follows.
NAME TAGS
kns.default kns.default
kns.kube-system kns.kube-system
We recommend setting an alias as follows.
Note: In order to use the
calicoctl
alias when reading manifests, redirect the file into stdin, for example: