기본 개념

클러스터에서 사용 가능한 리소스의 특성을 정의하는 객체다. 일반적으로 노드 그룹의 특성과 연관되며, 가용성, 가격, 아키텍처, 모델 등 리소스의 다양한 특성을 구분한다.

# 예시: Spot과 On-demand 인스턴스 구분
apiVersion: kueue.x-k8s.io/v1beta1
kind: ResourceFlavor
metadata:
  name: spot
spec:
  nodeLabels:
    instance-type: spot
  nodeTaints:
  - effect: NoSchedule
    key: spot
    value: "true"

ResourceFlavor는 클러스터에서 사용 가능한 컴퓨트 리소스를 정의하고, 특정 노드 타입과 워크로드를 연결하여 세밀한 리소스 관리를 가능하게 하는 객체다.

클러스터의 리소스는 일반적으로 동질적이지 않다. 리소스는 다음과 같은 차이를 가질 수 있다:

주요 설정 필드

1. nodeLabels를 통한 노드 연결

클러스터의 노드 하위 집합과 ResourceFlavor를 연결하려면 노드를 고유하게 식별하는 일치하는 노드 레이블로 .spec.nodeLabels 필드를 구성할 수 있다.

apiVersion: kueue.x-k8s.io/v1beta1
kind: ResourceFlavor
metadata:
  name: gpu-a100
spec:
  nodeLabels:
    accelerator: nvidia-tesla-a100
    instance-type: gpu-optimized
    zone: us-west1-a

2. tolerations을 통한 자동 스케줄링

ResourceFlavor에서 tolerations을 설정하면, Kueue가 해당 tolerations을 GPU가 필요한 Pod에 자동으로 추가한다.

apiVersion: kueue.x-k8s.io/v1beta1
kind: ResourceFlavor
metadata:
  name: spot-flavor
spec:
  nodeLabels:
    instance-type: spot
  tolerations: # Kueue가 자동으로 Pod에 추가
  - key: "spot-taint"
    operator: "Exists"
    effect: "NoSchedule"

동작 방식: