More precisely, the pod is eligible to run on node N if node N has a label with key failure-domain.beta.kubernetes.io/zone and some value V such that there is at least one node in the cluster with key failure-domain.beta.kubernetes.io/zone and value V that is running a pod that has a label with key “security” and value “S1”
pod能够落在的node N 必须满足:N有一个key为failure-domain.beta.kubernetes.io/zone并且value为某个值V的标签,这样集群中就至少有一个node拥有这个标签,并且有一个 key 为 “security” 并且 value 为 “S1” 的标签的 pod 在之上运行
这里的demo的yaml里根本就没有判断failure-domain.beta.kubernetes.io/zone的值,文档里却说and value V 顺着官方的说法也就是说存在这个键的node去判断
但是现实里使用的更多是去根据值去判断node,例如
1 2 3 4
area: beijing area: shanghai disktype: ide disktype: ssd
甚至自己的label都用这样值去区分
1 2 3 4 5 6
[root@k8s-m1 k8s]# kubectl get nodes --show-labels NAME STATUS ROLES AGE VERSION LABELS k8s-m1 Ready master 6d v1.10.3 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=k8s-m1,node-role.kubernetes.io/master= k8s-m2 Ready master 6d v1.10.3 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=k8s-m2,node-role.kubernetes.io/master= k8s-m3 Ready master 6d v1.10.3 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=k8s-m3,node-role.kubernetes.io/master= k8s-n1 Ready node 6d v1.10.3 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/hostname=k8s-n1,node-role.kubernetes.io/node=