- Node Selectors
pod-definition.yml
spec:
nodeSelector:
size: Large ##生效前需要先标记 node
kubectl label nodes <node-name> <label-key>=<label-value>
: 标记node
- Node Affinity
pod-definition.yml
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: size
operator: NotIn | In | Exists ## Exists运算符甚至不需要下面的values
values:
- Large
- Medium
Available :
- requiredDuringSchedulingIgnoredDuringExecution
- preferredDuringSchedulingIgnoredDuringExecution
Planned :
- requiredDuringSchedulingrequiredDuringExecution
DuringScheduling : Pod不存在且是首次创建
DuringScheduling | DuringExecution | |
---|---|---|
Type1 | Required | Ignored |
Type2 | Preferred | Ignored |
Type3 | Required | Required |