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

리소스 정의

원문 보기 위키 갱신

calicoctl이나 kubectl로 관리할 수 있는 Calico 리소스 유형 전체를 소개해요. 매니페스트의 기본 구조, 스키마, 지원되는 kind 목록, 파일 하나에 여러 리소스를 담는 방법까지 정리했어요. 리소스를 다루기 전에 이 문서로 전체 그림을 잡아 보세요.

출처: 문서

본문

이 섹션은 calicoctl 또는 kubectl로 관리할 수 있는 유효한 리소스 유형 집합을 설명해요.

리소스는 YAML이나 JSON 형식으로 줄 수 있지만, 이 가이드는 YAML로 예시를 제공해요.

리소스 구조 개요

리소스 관리용 calicoctl 명령(create, apply, delete, replace, get)은 모두 리소스 매니페스트를 입력으로 받아요.

각 매니페스트는 단일 리소스(예: profile 리소스)를 담거나, 여러 리소스의 목록(예: profile 하나와 hostEndpoint 리소스 두 개)을 담을 수 있어요.

단일 리소스의 일반적인 구조는 다음과 같아요:

apiVersion: projectcalico.org/v3
kind: <type of resource>
metadata:
  # Identifying information
  name: <name of resource>
  ...
spec:
  # Specification of the resource
  ...

스키마

Field Description Accepted Values Schema
apiVersion Indicates the version of the API that the data corresponds to. projectcalico.org/v3 string
kind Specifies the type of resource described by the YAML document. kind
metadata Contains information used to uniquely identify the particular instance of the resource. map
spec Contains the resource specification. map

지원되는 kind

다음 리소스들이 지원돼요:

리소스 이름 요건

모든 리소스에는 name 필드가 반드시 지정되어야 해요. 이름은 네임스페이스 안에서 유일해야 해요. 리소스 생성 시 이름이 필요하고, 이후에는 업데이트할 수 없어요. 유효한 리소스 이름은 영숫자와 선택적인 ., _, -를 사용할 수 있고, 총 128자까지 가능해요.

파일 하나에 여러 리소스 담기

파일에는 YAML 리스트 형식으로 여러 리소스 문서를 담을 수 있어요. 예를 들어 다음은 HostEndpoint 리소스 두 개를 담은 파일의 내용이에요:

- apiVersion: projectcalico.org/v3
  kind: HostEndpoint
  metadata:
    name: endpoint1
    labels:
      type: database
  spec:
    interface: eth0
    node: host1
    profiles:
      - prof1
      - prof2
    expectedIPs:
      - 1.2.3.4
      - '00:bb::aa'
- apiVersion: projectcalico.org/v3
  kind: HostEndpoint
  metadata:
    name: endpoint2
    labels:
      type: frontend
  spec:
    interface: eth1
    node: host1
    profiles:
      - prof1
      - prof2
    expectedIPs:
      - 1.2.3.5

더 알아보기 (Learn more)

Calico 리소스는 apiVersion/kind/metadata/spec의 네 덩어리로 구성돼요. 이름은 128자까지, 네임스페이스 안에서 유일해야 하고 생성 후 변경이 안 돼요. YAML 목록 형식으로 한 파일에 여러 리소스를 담아 한 번에 적용할 수 있어요.