calicoctl node run
This sections describes the calicoctl node run
command.
Read the calicoctl Overview for a full list of calicoctl commands.
Displaying the help text for ‘calicoctl node run’ command
Run calicoctl node run --help
to display the following help menu for the
command.
Kubernetes as the datastore
When Calico is configured to use the Kubernetes API as the datastore, BGP routing is currently not supported. Many of the command line options related to BGP routing will have no effect. These include:
--ip
,--ip6
,--ip-autodetection-method
,--ip6-autodetection-method
--as
--backend
Examples
Start the calico/node with a pre-configured IPv4 address for BGP.
sudo calicoctl node run
An example response follows.
IP Autodetection method examples
The node resource includes IPv4 and IPv6 routing IP addresses that should
match those on one of the host interfaces. These IP addresses may be
configured in advance by configuring the node resource prior to starting the
calico/node
service, alternatively, the addresses may either be explicitly
specified or autodetected through options on the calicoctl run
command.
There are different autodetection methods available and you should use the one best suited to your deployment. If you are able to explicitly specify the IP addresses, that is always preferred over autodetection. This section describes the available methods for autodetecting the hosts IP addresses.
An IPv4 address is always required, and so if no address was previously configured in the node resource, and no address was specified on the CLI, then we will attempt to autodetect an IPv4 address. An IPv6 address, however, will only be autodetected when explicitly requested.
To force autodetection of an IPv4 address, use the option --ip=autodetect
. To
force autodetection of an IPv6 address, use the option --ip6=autodetect
.
To set the autodetection method for IPv4, use the --ip-autodetection-method
option.
To set the autodetection method for IPv6, use the --ip6-autodetection-method
option.
Note: If you are starting the
calico/node
container directly (and not using thecalicoctl run
helper command), the options are passed in environment variables. These are described in Configuringcalico/node
.
first-found
The first-found
option enumerates all interface IP addresses and returns the
first valid IP address (based on IP version and type of address) on
the first valid interface. Certain known “local” interfaces
are omitted, such as the docker bridge. The order that both the interfaces
and the IP addresses are listed is system dependent.
This is the default detection method. However, since this method only makes a very simplified guess, it is recommended to either configure the node with a specific IP address, or to use one of the other detection methods.
An example with first-found auto detection method explicitly specified follows
sudo calicoctl node run --ip autodetect --ip-autodetection-method first-found
can-reach=DESTINATION
The can-reach
method uses your local routing to determine which IP address
will be used to reach the supplied destination. Both IP addresses and domain
names may be used.
An example with IP detection using a can-reach IP address:
sudo calicoctl node run --ip autodetect --ip-autodetection-method can-reach=8.8.8.8
An example with IP detection using a can-reach domain name:
sudo calicoctl node run --ip autodetect --ip-autodetection-method can-reach=www.google.com
interface=INTERFACE-REGEX,INTERFACE-REGEX,…
The interface
method uses the supplied interface regular expressions (golang
syntax) to enumerate matching interfaces and to return the first IP address on
the first interface that matches any of the interface regexes provided. The
order that both the interfaces and the IP addresses are listed is system
dependent.
Example with IP detection on interface eth0:
sudo calicoctl node run --ip autodetect --ip-autodetection-method interface=eth0
Example with IP detection on interfaces eth0, eth1, eth2 etc.:
sudo calicoctl node run --ip autodetect --ip-autodetection-method interface=eth.*
An example with IP detection on interfaces eth0, eth1, eth2 etc. and wlp2s0:
sudo calicoctl node run --ip-autodetect --ip-autodetection-method interface=eth.*,wlp2s0
skip-interface=INTERFACE-REGEX,INTERFACE-REGEX,…
The skip-interface
method uses the supplied interface regular expressions (golang
syntax) to enumerate all interface IP addresses and returns the first valid IP address
(based on IP version and type of address) that does not match the listed regular
expressions. Like the first-found
option, it also skips by default certain known
“local” interfaces such as the docker bridge. The order that both the interfaces
and the IP addresses are listed is system dependent.
This method has the ability to take in multiple regular expressions separated by ,
.
Specifying only one regular expression for interfaces to skip will also work and a
terminating ,
character does not need to be specified for those cases.
Options
General options
See also
- Installing calicoctl
- Resources for details on all valid resources, including file format and schema
- Policy for details on the Calico selector-based policy model