Chap 59. Node Selector
# pod-definition.yaml
apiVersion:
kind : Pod
metadata:
name : myapp-pod
spec:
containers:
- name : data-processor
image : data-processor
nodeSelector:
size: Large
Label Nodes
$kubectl label nodes <node-name> <label-key>=<label-value>
$kubectl label nodes ndoe-1 size=Large
Chap 60. Node Affinity(노드 선호도)
- Node Affinity 의 주요 목적은 Pod 가 특정 노드에 호스팅되게하는 것이다.
apiVersion: kind:
metadata:
name: myapp-pod
spec:
containers:
- name: data-processor
image: data-processor
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution: # when
nodeSelectorTerms:
- matchExpressions:
- key: size
operator: In # 오퍼레이터
values:
- Large
- Midium
apiVersion: kind:
metadata:
name: myapp-pod
spec:
containers:
- name: data-processor
image: data-processor
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution: # when
nodeSelectorTerms:
- matchExpressions:
- key: size
operator: NotIn # 오퍼레이터
values:
- Small
apiVersion: kind:
metadata:
name: myapp-pod
spec:
containers:
- name: data-processor
image: data-processor
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution: # when
nodeSelectorTerms:
- matchExpressions:
- key: size
operator: Exists
Node Affinity Types