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

calicoctl node run

원문 보기 위키 갱신

calicoctl node run 명령은 주어진 옵션으로 calico/node 인스턴스를 시작할 때 사용하는 레퍼런스 명령이에요. 이 문서는 명령의 도움말 출력, Kubernetes 데이터스토어에서의 제약, 그리고 IP 자동 탐지 방법까지 차근차근 설명해요. 단일 호스트에서 Calico 노드 컨테이너를 직접 운영할 때 필요한 옵션을 모두 여기서 확인할 수 있어요.

출처: 문서

본문

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

calicoctl 명령 전체 목록은 calicoctl 개요를 읽어 보세요.

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

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

Start the Calico node container on this host. Runs the calico/node image with
the supplied networking options; most options mirror fields on the node
resource and are autodetected when omitted.

Usage:
  calicoctl node run [flags]

Examples:
  # Start calico/node, autodetecting the IPv4 address.
  calicoctl node run --ip autodetect --ip-autodetection-method can-reach=8.8.8.8

Flags:
      --as string                         Set the AS number for this node.
      --backend string                    Specify which networking backend to use (bird|none). (default "bird")
  -c, --config string                     Path to the file containing connection configuration in YAML or JSON format. (default "/etc/calico/calicoctl.cfg")
      --dryrun                            Output the appropriate command, without starting the container.
      --felix-config string               Path to the file containing Felix configuration.
  -h, --help                              help for run
      --init-system                       Run the appropriate command to use with an init system.
      --ip string                         Set the local IPv4 routing address for this node.
      --ip-autodetection-method string    Specify the autodetection method for detecting the local IPv4 routing address. (default "first-found")
      --ip6 string                        Set the local IPv6 routing address for this node.
      --ip6-autodetection-method string   Specify the autodetection method for detecting the local IPv6 routing address. (default "first-found")
      --log-dir string                    The directory containing Calico logs. (default "/var/log/calico")
      --name string                       The name of the Calico node.
      --no-default-ippools                Do not create default pools upon startup.
      --node-image string                 Docker image to use for Calico's per-node container. (default "quay.io/calico/node:latest")

Global Flags:
      --allow-version-mismatch   Allow client and cluster versions mismatch
      --context string           The name of the kubeconfig context to use
  -l, --log-level string         Set the log level (panic, fatal, error, warn, info, debug) (default "panic")

Kubernetes를 데이터스토어로 사용할 때

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

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

예제

BGP를 위해 미리 구성된 IPv4 주소로 calico/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 calico/node:v3.33.0

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 주소가 들어 있어요. 이 IP 주소들은 calico/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: calico/node 컨테이너를 직접 시작한다면(calicoctl run 헬퍼 명령을 쓰지 않고), 옵션은 환경 변수로 전달해요. 이 내용은 calico/node 구성 문서에 설명되어 있어요.

first-found

first-found 옵션은 모든 인터페이스 IP 주소를 나열하고, 첫 번째 유효한 인터페이스에서 첫 번째 유효한 IP 주소(IP 버전과 주소 타입 기준)를 반환해요. docker bridge처럼 알려진 "로컬" 인터페이스 몇 가지는 제외해요. 인터페이스와 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 옵션처럼 docker bridge 같은 알려진 "로컬" 인터페이스 몇 가지도 기본적으로 건너뛰어요. 인터페이스와 IP 주소가 나열되는 순서는 시스템에 따라 달라져요.

이 방법은 ,로 구분해 여러 정규식을 받을 수 있어요. 건너뛸 인터페이스의 정규식을 하나만 지정해도 동작하고, 그 경우 마지막 , 문자는 쓰지 않아도 돼요.

옵션

      --name string                       The name of the Calico node.
      --as string                         Set the AS number for this node.
      --ip string                         Set the local IPv4 routing address for this node.
      --ip6 string                        Set the local IPv6 routing address for this node.
      --ip-autodetection-method string    Specify the autodetection method for detecting the local IPv4 routing address. (default "first-found")
      --ip6-autodetection-method string   Specify the autodetection method for detecting the local IPv6 routing address. (default "first-found")
      --log-dir string                    The directory containing Calico logs. (default "/var/log/calico")
      --node-image string                 Docker image to use for Calico's per-node container. (default "quay.io/calico/node:latest")
      --backend string                    Specify which networking backend to use (bird|none). (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.

일반 옵션

  -c, --config string   Path to the file containing connection configuration in YAML or JSON format. (default "/etc/calico/calicoctl.cfg")

더 보기

  • calicoctl 설치
  • 리소스 — 파일 형식과 스키마를 포함해 모든 유효한 리소스의 상세 내용
  • 정책 — Calico의 셀렉터 기반 정책 모델 상세

더 알아보기 (Learn more)

calicoctl node run은 단일 호스트에 calico/node 컨테이너를 띄우는 명령이에요. Kubernetes API 데이터스토어에서는 BGP 관련 옵션이 무시된다는 점과, IP 자동 탐지 방법(first-found, can-reach, interface, skip-interface)의 차이를 알아 두면 네트워크 구성 시 큰 도움이 돼요.