Three scheduling policies k8s POD

Three methods of scheduling POD:

  1. Stain, tolerance

  2. nodeName: Let POD running on the node in the development of

  3. 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:image.png

[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

image.png

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


Guess you like

Origin blog.51cto.com/13520772/2485071