본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

calicoctl node run

원문 보기 위키 갱신

calicoctl node run 명령에 대해 설명해요. calicoctl 명령 전체 목록이 필요하면 calicoctl Overview를 먼저 확인해 보세요. 이 명령은 컴퓨트 호스트에서 Calico 네트워킹과 네트워크 폴리시를 제공하는 node 컨테이너 인스턴스를 시작할 때 써요.

출처: calicoctl node run

본문

이 섹션은 calicoctl node run 명령을 설명해요.

calicoctl 명령 전체 목록은 calicoctl Overview를 참고하세요.

'calicoctl node run' 명령의 도움말 표시하기

calicoctl node run --help를 실행하면 다음과 같은 명령 도움말 메뉴가 표시돼요.

Usage:
  calicoctl node run [--ip=<IP>] [--ip6=<IP6>] [--as=<AS_NUM>]
                     [--name=<NAME>]
                     [--ip-autodetection-method=<IP_AUTODETECTION_METHOD>]
                     [--ip6-autodetection-method=<IP6_AUTODETECTION_METHOD>]
                     [--log-dir=<LOG_DIR>]
                     [--node-image=<DOCKER_IMAGE_NAME>]
                     [--backend=(bird|none)]
                     [--config=<CONFIG>]
                     [--felix-config=<CONFIG>]
                     [--no-default-ippools]
                     [--dryrun]
                     [--init-system]
                     [--disable-docker-networking]
                     [--docker-networking-ifprefix=<IFPREFIX>]
                     [--use-docker-networking-container-labels]

Options:
  -h --help                Show this screen.
     --name=<NAME>         The name of the Calico node.  If this is not
                           supplied it defaults to the host name.
     --as=<AS_NUM>         Set the AS number for this node.  If omitted, it
                           will use the value configured on the node resource.
                           If there is no configured value and --as option is
                           omitted, the node will inherit the global AS number
                           (see 'calicoctl config' for details).
     --ip=<IP>             Set the local IPv4 routing address for this node.
                           If omitted, it will use the value configured on the
                           node resource.  If there is no configured value
                           and the --ip option is omitted, the node will
                           attempt to autodetect an IP address to use.  Use a
                           value of 'autodetect' to always force autodetection
                           of the IP each time the node starts.
     --ip6=<IP6>           Set the local IPv6 routing address for this node.
                           If omitted, it will use the value configured on the
                           node resource.  If there is no configured value
                           and the --ip6 option is omitted, the node will not
                           route IPv6.  Use a value of 'autodetect' to force
                           autodetection of the IP each time the node starts.
     --ip-autodetection-method=<IP_AUTODETECTION_METHOD>
                           Specify the autodetection method for detecting the
                           local IPv4 routing address for this node.  The valid
                           options are:
                           > first-found
                             Use the first valid IP address on the first
                             enumerated interface (common known exceptions are
                             filtered out, e.g. the docker bridge).  It is not
                             recommended to use this if you have multiple
                             external interfaces on your host.
                           > can-reach=<IP OR DOMAINNAME>
                             Use the interface determined by your host routing
                             tables that will be used to reach the supplied
                             destination IP or domain name.
   			   > interface=<IFACE NAME REGEX LIST>
                             Use the first valid IP address found on interfaces
                             named as per the first matching supplied interface
    			     name regex. Regexes are separated by commas
    			     (e.g. eth.*,enp0s.*).
   			   > skip-interface=<IFACE NAME REGEX LIST>
    			     Use the first valid IP address on the first
    			     enumerated interface (same logic as first-found
    			     above) that does NOT match with any of the
    			     specified interface name regexes. Regexes are
    			     separated by commas (e.g. eth.*,enp0s.*).
                           [default: first-found]
     --ip6-autodetection-method=<IP6_AUTODETECTION_METHOD>
                           Specify the autodetection method for detecting the
                           local IPv6 routing address for this node.  See
                           ip-autodetection-method flag for valid options.
                           [default: first-found]
     --log-dir=<LOG_DIR>   The directory containing Calico logs.
                           [default: /var/log/calico]
     --node-image=<DOCKER_IMAGE_NAME>
                           Docker image to use for Calico's per-node container.
                           [default: quay.io/tigera/node:latest]
     --backend=(bird|none)
                           Specify which networking backend to use.  When set
                           to "none", Calico node runs in policy only mode.
                           [default: bird]
     --dryrun              Output the appropriate command, without starting the
                           container.
     --init-system         Run the appropriate command to use with an init
                           system.
     --no-default-ippools  Do not create default pools upon startup.
                           Default IP pools will be created if this is not set
                           and there are no pre-existing Calico IP pools.
     --disable-docker-networking
                           Disable Docker networking.
     --docker-networking-ifprefix=<IFPREFIX>
                           Interface prefix to use for the network interface
                           within the Docker containers that have been networked
                           by the Calico driver.
                           [default: cali]
     --use-docker-networking-container-labels
                           Extract the Calico-namespaced Docker container labels
                           (org.projectcalico.label.*) and apply them to the
                           container endpoints for use with Calico policy.
                           This option is only valid when using Calico Docker
                           networking, and when enabled traffic must be
                           explicitly allowed by configuring Calico policies.
  -c --config=<CONFIG>     Path to the file containing connection
                           configuration in YAML or JSON format.
                           [default: /etc/calico/calicoctl.cfg]
     --felix-config=<CONFIG>
                            Path to the file containing Felix
                            configuration in YAML or JSON format.

Description:
  This command is used to start a node container instance which provides
  Calico networking and network policy on your compute host.

Kubernetes를 데이터스토어로 쓸 때

Calico Enterprise가 Kubernetes API를 데이터스토어로 쓰도록 구성돼 있다면, BGP 라우팅은 현재 지원되지 않아요. BGP 라우팅과 관련된 명령줄 옵션 대부분은 효과가 없어요. 해당 옵션은 다음과 같아요:

  • --ip, --ip6, --ip-autodetection-method, --ip6-autodetection-method
  • --as
  • --backend

예시

미리 구성된 IPv4 주소로 BGP를 쓰며 node를 시작해요.

sudo calicoctl node run

예시 응답은 다음과 같아요.

Running command to load modules: modprobe -a xt_set ip6_tables
Enabling IPv4 forwarding
Enabling IPv6 forwarding
Increasing conntrack limit
Running the following command:

docker run --net=host --privileged --name=calico-node -d --restart=always -e ETCD_SCHEME=http -e HOSTNAME=calico -e ETCD_AUTHORITY=127.0.0.1:2379 -e AS= -e NO_DEFAULT_POOLS= -e ETCD_ENDPOINTS= -e IP= -e IP6= -e CALICO_NETWORKING_BACKEND=bird -v /var/run/docker.sock:/var/run/docker.sock -v /var/run/calico:/var/run/calico -v /lib/modules:/lib/modules -v /var/log/calico:/var/log/calico -v /run/docker/plugins:/run/docker/plugins quay.io/tigera/node:v3.23.2

Waiting for etcd connection...
Using configured IPv4 address: 192.0.2.0
No IPv6 address configured
Using global AS number
WARNING: Could not confirm that the provided IPv4 address is assigned to this host.
Calico node name:  calico
Calico node started successfully

IP 자동 감지 방식 예시

node 리소스에는 호스트 인터페이스 중 하나의 주소와 일치해야 하는 IPv4·IPv6 라우팅 IP 주소가 들어 있어요. 이 주소들은 node 서비스를 시작하기 전에 node 리소스를 구성해 미리 정해 둘 수도 있고, calicoctl run 명령의 옵션으로 직접 지정하거나 자동 감지되게 할 수도 있어요.

자동 감지 방식은 여러 가지가 있고, 배포 환경에 가장 잘 맞는 것을 고르면 돼요. IP 주소를 직접 지정할 수 있다면 자동 감지보다 항상 그쪽이 좋아요. 이 섹션에서는 호스트 IP 주소를 자동 감지하는 방법들을 설명해요.

IPv4 주소는 항상 필요해요. 그래서 node 리소스에 미리 주소가 구성돼 있지 않고 CLI에서도 지정하지 않았다면 IPv4 주소 자동 감지를 시도해요. 반면 IPv6 주소는 명시적으로 요청했을 때만 자동 감지해요.

IPv4 주소의 자동 감지를 강제하려면 --ip=autodetect 옵션을, IPv6 주소라면 --ip6=autodetect 옵션을 쓰세요.

IPv4 자동 감지 방식을 정하려면 --ip-autodetection-method 옵션을, IPv6라면 --ip6-autodetection-method 옵션을 쓰세요.

SECONDARY: node 컨테이너를 직접 시작하는 경우(calicoctl run 헬퍼 명령을 쓰지 않는 경우)에는 옵션이 환경 변수로 전달돼요. 이 내용은 Configuring node에 설명돼 있어요.

first-found

first-found 옵션은 모든 인터페이스 IP 주소를 나열하고, 첫 번째 유효한 인터페이스에서 첫 번째 유효한 IP 주소(IP 버전과 주소 타입 기준)를 반환해요. 도커 브리지 같이 알려진 "로컬" 인터페이스 일부는 제외돼요. 인터페이스와 IP 주소가 나열되는 순서는 시스템에 따라 달라져요.

이게 기본 감지 방식이에요. 다만 이 방식은 매우 단순한 추측만 하기 때문에, node에 특정 IP 주소를 구성하거나 다른 감지 방식을 쓰는 걸 권해요.

first-found 자동 감지 방식을 명시적으로 지정한 예시예요.

sudo calicoctl node run --ip autodetect --ip-autodetection-method first-found

can-reach=DESTINATION

can-reach 방식은 로컬 라우팅을 이용해 주어진 목적지에 도달하는 데 쓰일 IP 주소를 판별해요. IP 주소와 도메인 이름 둘 다 쓸 수 있어요.

can-reach IP 주소로 IP를 감지하는 예시예요:

sudo calicoctl node run --ip autodetect --ip-autodetection-method can-reach=8.8.8.8

can-reach 도메인 이름으로 IP를 감지하는 예시예요:

sudo calicoctl node run --ip autodetect --ip-autodetection-method can-reach=www.google.com

interface=INTERFACE-REGEX,INTERFACE-REGEX,...

interface 방식은 주어진 인터페이스 정규식(golang 문법)으로 매칭되는 인터페이스를 나열하고, 제공된 인터페이스 정규식 중 하나라도 매칭되는 첫 번째 인터페이스의 첫 IP 주소를 반환해요. 인터페이스와 IP 주소가 나열되는 순서는 시스템에 따라 달라져요.

eth0 인터페이스에서 IP를 감지하는 예시예요:

sudo calicoctl node run --ip autodetect --ip-autodetection-method interface=eth0

eth0, eth1, eth2 등의 인터페이스에서 IP를 감지하는 예시예요:

sudo calicoctl node run --ip autodetect --ip-autodetection-method interface=eth.*

eth0, eth1, eth2 등과 wlp2s0 인터페이스에서 IP를 감지하는 예시예요:

sudo calicoctl node run --ip-autodetect --ip-autodetection-method interface=eth.*,wlp2s0

skip-interface=INTERFACE-REGEX,INTERFACE-REGEX,...

skip-interface 방식은 주어진 인터페이스 정규식(golang 문법)으로 모든 인터페이스 IP 주소를 나열하고, 나열된 정규식에 매칭되지 않는 첫 번째 유효한 IP 주소(IP 버전과 주소 타입 기준)를 반환해요. first-found 옵션처럼 도커 브리지 같은 알려진 "로컬" 인터페이스를 기본적으로 건너뛰기도 해요. 인터페이스와 IP 주소가 나열되는 순서는 시스템에 따라 달라져요.

이 방식은 ,로 구분된 여러 정규식을 받을 수 있어요. 건너뛸 인터페이스 정규식을 하나만 지정해도 되고, 그 경우 끝에 ,를 붙일 필요는 없어요.

Options

   --name=<NAME>         The name of the Calico node.  If this is not
                         supplied it defaults to the host name.
   --as=<AS_NUM>         Set the AS number for this node.  If omitted, it
                         will use the value configured on the node resource.
                         If there is no configured value and --as option is
                         omitted, the node will inherit the global AS number
                         (see 'calicoctl config' for details).
   --ip=<IP>             Set the local IPv4 routing address for this node.
                         If omitted, it will use the value configured on the
                         node resource.  If there is no configured value
                         and the --ip option is omitted, the node will
                         attempt to autodetect an IP address to use.  Use a
                         value of 'autodetect' to always force autodetection
                         of the IP each time the node starts.
   --ip6=<IP6>           Set the local IPv6 routing address for this node.
                         If omitted, it will use the value configured on the
                         node resource.  If there is no configured value
                         and the --ip6 option is omitted, the node will not
                         route IPv6.  Use a value of 'autodetect' to force
                         autodetection of the IP each time the node starts.
   --ip-autodetection-method=<IP_AUTODETECTION_METHOD>
                         Specify the autodetection method for detecting the
                         local IPv4 routing address for this node.  The valid
                         options are:
                         > first-found
                           Use the first valid IP address on the first
                           enumerated interface (common known exceptions are
                           filtered out, e.g. the docker bridge).  It is not
                           recommended to use this if you have multiple
                           external interfaces on your host.
                         > can-reach=<IP OR DOMAINNAME>
                           Use the interface determined by your host routing
                           tables that will be used to reach the supplied
                           destination IP or domain name.
			 > interface=<IFACE NAME REGEX LIST>
                           Use the first valid IP address found on interfaces
                           named as per the first matching supplied interface
			   name regex. Regexes are separated by commas
			   (e.g. eth.*,enp0s.*).
			 > skip-interface=<IFACE NAME REGEX LIST>
			   Use the first valid IP address on the first
			   enumerated interface (same logic as first-found
			   above) that does NOT match with any of the
			   specified interface name regexes. Regexes are
			   separated by commas (e.g. eth.*,enp0s.*).
                         [default: first-found]
   --ip6-autodetection-method=<IP6_AUTODETECTION_METHOD>
                         Specify the autodetection method for detecting the
                         local IPv6 routing address for this node.  See
                         ip-autodetection-method flag for valid options.
                         [default: first-found]
   --log-dir=<LOG_DIR>   The directory containing Calico logs.
                         [default: /var/log/calico]
   --node-image=<DOCKER_IMAGE_NAME>
                         Docker image to use for Calico's per-node container.
                         [default: quay.io/tigera/node:latest]
   --backend=(bird|none)
                         Specify which networking backend to use.  When set
                         to "none", Calico node runs in policy only mode.
                         [default: bird]
   --dryrun              Output the appropriate command, without starting the
                         container.
   --init-system         Run the appropriate command to use with an init
                         system.
   --no-default-ippools  Do not create default pools upon startup.
                         Default IP pools will be created if this is not set
                         and there are no pre-existing Calico IP pools.
   --disable-docker-networking
                         Disable Docker networking.
   --docker-networking-ifprefix=<IFPREFIX>
                         Interface prefix to use for the network interface
                         within the Docker containers that have been networked
                         by the Calico driver.
                         [default: cali]
   --use-docker-networking-container-labels
                         Extract the Calico-namespaced Docker container labels
                         (org.projectcalico.label.*) and apply them to the
                         container endpoints for use with Calico policy.
                         This option is only valid when using Calico Docker
                         networking, and when enabled traffic must be
                         explicitly allowed by configuring Calico policies.

General options

-c --config=<CONFIG>     Path to the file containing connection
                         configuration in YAML or JSON format.
                         [default: /etc/calico/calicoctl.cfg]

See also

  • Installing calicoctl
  • Resources — 파일 형식과 스키마를 포함한 모든 유효 리소스의 상세
  • Policy — Calico Enterprise 셀렉터 기반 폴리시 모델의 상세

더 알아보기 (Learn more)