GitHub

https://github.com/Choidongjun0830

클라우드

Node Selector, Node Affinity

gogi masidda 2024. 12. 16. 15:41

Node Selector

  • Pod가 특정 노드에서만 작동하도록 하는 것.
  • 복잡한 요구 사항이 있으면 Node Selector로는 구현 불가 
apiVersion: v1
kind: Pod
metadata:
  name: myapp-pod
spec:
  containers:
  - name: data-processor
    image: data-processor
  nodeSelector:
    size: Large //label

 

Node Affinity

  • Node Selector와 달리 특정 노드에 특정 Pod를 할당하는 것을 제한 가능 
apiVersion: v1
kind: Pod
metadata:
  name: myapp-pod
spec:
  containers:
  - name: data-processor
    image: data-processor
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoreDuringExecution:
      	nodeSelectorTerms:
        - matchExpressions:
          - key: size
            operator: In
            values:
            - Large
            - Medium
apiVersion: v1
kind: Pod
metadata:
  name: myapp-pod
spec:
  containers:
  - name: data-processor
    image: data-processor
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoreDuringExecution:
      	nodeSelectorTerms:
        - matchExpressions:
          - key: size
            operator: NotIn
            values:
            - Small
  • Node Affinity Types
    • requiredDuringSchedulingIgnoredDuringExecution
    • preferDuringSchedulingIgnoredDuringExecution
    • requiredDuringSchedulingRequiredDuringExecution
728x90

'클라우드' 카테고리의 다른 글

Operating System Upgrade  (0) 2024.12.18
Monitor Kubernetes Cluster  (0) 2024.12.17
Taints and Tolerations  (0) 2024.12.16
Maual Scheduling  (0) 2024.12.16
Secret, ConfigMap  (0) 2024.12.07