k8s中三种POD调度策略
作者:互联网
三种调度POD的方法:
污点、容忍度
nodeName:让POD运行在制定的node上
nodeSelecter:通过标签选择器,让POD运行在制定的一组node上
先创建一个简单的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
没做污点的时候,现在是两个节点上各运行一组POD:
[root@hdss7-21 ~]# kubectl taint node hdss7-22.host.com role=node:NoSchedule
如果给node7-22这个节点加污点,该节点将不会被调度pod,因为NoSchedule的意思是不调度
那么如果要给有污点的node节点调度POD,可以使用容忍度配置,在template下添加配置:
template: metadata: labels: app: nginx-dp tolertions: - key: role value: node effect: NoSchedule
标签:node,app,调度,nginx,污点,POD,k8s,dp 来源: https://blog.51cto.com/13520772/2485071