Three methods of scheduling POD:
Stain, tolerance
nodeName: Let POD running on the node in the development of
nodeSelecter: by tag selector, let POD runs on in the development of a set of node
Create a simple deployment:
[root@hdss7-21 ~]# cat nginx-dp.yaml apiVersion: extensions/v1beta1 kind: Deployment metadata: labels: app: nginx-dp name: nginx-dp namespace: kube-public spec: replicas: 2 selector: matchLabels: app: nginx-dp template: metadata: labels: app: nginx-dp spec: containers: - image: harbor.od.com/public/nginx:v1.7.9 imagePullPolicy: IfNotPresent name: nginx
Do not stain, it is time to run a set of each POD on both nodes:
[root@hdss7-21 ~]# kubectl taint node hdss7-22.host.com role=node:NoSchedule
If this node added to node7-22 stain, the POD node will not be scheduled, because it is not scheduling means NoSchedule
So If you give tainted node node scheduling POD, tolerance can be used to configure, add configuration in template:
template: metadata: labels: app: nginx-dp tolertions: - key: role value: node effect: NoSchedule