Taints & Tolerations
ΠΠ»Ρ ΡΠ°ΡΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΡ Pods ΠΏΠΎ Nodes ΠΏΡΠΈΠΌΠ΅Π½ΡΠ΅ΡΡΡ ΡΠΎΡΠ΅ΡΠ°Π½ΠΈΠ΅ ΠΏΠΎΠΊΡΠ°ΡΠΊΠΈ (taint) ΠΈ Π²ΠΎΡΠΏΡΠΈΠΈΠΌΡΠΈΠ²ΠΎΡΡΠΈ (toleration) ΠΊ Π½Π΅ΠΉ.
Taints
ΠΠΎΠΊΡΠ°ΡΠΊΠ° Node Π³ΠΎΠ²ΠΎΡΠΈΡ kube-scheduler, ΡΡΠΎ Π΅ΡΡΡ 1 ΠΈΠ· 3 ΡΡΡΠ΅ΠΊΡΠΎΠ²:
- NoSchedule - Π½Π΅ Π½Π°Π·Π½Π°ΡΠ°ΡΡ ΡΡΠ΄Π° Pods Π±Π΅Π· toleration;
- PreferNo Schedule - Π½Π°Π·Π½Π°ΡΠ°ΡΡ Pods Π±Π΅Π· toleration Ρ Π½Π°ΠΈΠΌΠ΅Π½ΡΡΠΈΠΌ ΠΏΡΠΈΠΎΡΠΈΡΠ΅ΡΠΎΠΌ, Π΅ΡΠ»ΠΈ Π±ΠΎΠ»ΡΡΠ΅ Π½Π΅ΠΊΡΠ΄Π°;
- NoExecute - Π½Π΅ Π½Π°Π·Π½Π°ΡΠ°ΡΡ ΡΡΠ΄Π° Pods Π±Π΅Π· toleration, ΡΠΆΠ΅ ΠΈΠΌΠ΅ΡΡΠΈΠ΅ΡΡ ΡΡΡ Pods ΡΠ΄Π°Π»ΠΈΡΡ ΠΈ ΠΏΠ΅ΡΠ΅Π½Π΅ΡΡΠΈ ΠΊΡΠ΄Π°-ΡΠΎ Π΅ΡΡ.
ΠΠΎΠΊΡΠ°ΡΠΊΠ° node:
kubectl taint nodes <ΠΈΠΌΡ node> key=value:effect
kubectl taint nodes node01 app=myapp:NoSchedule # ΠΏΡΠΈΠΌΠ΅Ρ
kubectl taint nodes node01 app=myapp:NoSchedule- # ΠΌΠΈΠ½ΡΡ Π² ΠΊΠΎΠ½ΡΠ΅ ΡΠ½ΠΈΠΌΠ°Π΅Ρ ΠΏΠΎΠΊΡΠ°Ρ
Tolerations
ΠΠΎΠΌΠ΅Π½ΡΡΡ Π²ΠΎΡΠΏΡΠΈΠΈΠΌΡΠΈΠ²ΠΎΡΡΡ Pod ΠΊ ΠΏΠΎΠΊΡΠ°ΡΠΊΠ΅:
apiVersion: v1
kind: Pod
metadata:
name: myapp-pod
spec:
containers:
- name: nginx-controller
image: nginx
tolerations:
- key: "app"
operator: "Equal"
value: "blue"
effect: "NoSchedule"