zoukankan      html  css  js  c++  java
  • kubernetes如何将pod运行在master节点

    一.简单说明

    这里我们部署的Kubernetes集群,master节点默认是unscheduled的状态,也就是默认拒绝将Pod调度到master节点运行。专业术语就是:Master节点被赋予了一个或者多个"污点","污点"的作用是让该节点拒绝将Pod调度运行在其上。这种情况下,我们如果想让master节点可以调度pod运行如何实现,这里有两种方案:

    • 去掉污点(taints)
    • 让pod能够容器(tolerations)该节点上的污点。

    1.1 方案一:去掉污点

    • 查看节点调度情况
    [root@k8s001 ~]# kubectl get node 
    NAME             STATUS   ROLES    AGE   VERSION
    172.16.33.22   Ready    master   3d    v1.13.5
    172.16.33.23   Ready    node     3d    v1.13.5
    172.16.33.24   Ready    node     3d    v1.13.5
    [root@k8s001 ~]# kubectl describe node 172.16.33.22
    ......
    Events:
      Type    Reason              Age               From                     Message
      ----    ------              ----              ----                     -------
      Normal  NodeNotSchedulable  11s (x2 over 3d)  kubelet, 172.16.33.22  Node 172.16.33.22 status is now: NodeNotSchedulable
    ......
    
    • 去除污点
    [root@k8s001 ~]# kubectl uncordon 172.16.33.22
    

    1.2 方案二:增加污点容忍

    [root@k8s001 ~]# cat pod.yaml
    ......
    spec:
       tolerations:
        - key: node-role.kubernetes.io/master
          operator: Exists
          effect: NoSchedule
       containers:
        - name: nginx-pod
    ......
    
  • 相关阅读:
    setuptools使用
    YOLO解读
    Linux下配置Python的独立虚拟环境
    交叉熵(Cross Entropy)
    OpenCV-C++ Canny算法介绍
    OpenCV-C++ Laplance算子
    【模型部署】TF Serving 的使用
    OpenCV-C++ Sobel算子使用
    OpenCV-C++ 图像卷积计算的边缘问题
    OpenCV-C++ 自定义线性滤波
  • 原文地址:https://www.cnblogs.com/yuhaohao/p/13223247.html
Copyright © 2011-2022 走看看