业务场景
因为某些服务不稳定,导致会影响到基础的服务需要把服务强制绑定到某个节点。同时不允许其他服务调度到这个节点上。
配置如下。
可以通过界面或者命令行配置标签
配置污点命令如下
kubectl taint node nodexx1 node-type=production:NoSchedule
通过命令可以看到标签和污点已经设置好了
kubectl describe nodes nodexx1
1617354314(1).png
配置好后yaml文件设置如下即可

  template:
    metadata:
      labels:
        app: ${PROJECT_NAME}-${VERSION}
    spec:
      nodeSelector:
        project: lk
      imagePullSecrets:
        - name: harborxxx
      tolerations:
        - effect: NoSchedule
          key: node-type
          operator: Equal
          value: production

官网配置参考如下
https://kubernetes.io/zh/docs/concepts/scheduling-eviction/taint-and-toleration/

Last modification:April 2, 2021
如果觉得我的文章对你有用,请随意赞赏