zoukankan      html  css  js  c++  java
  • Kubernetes 污点 Taint 和容忍 Toleration

    详细:https://www.ziji.work/kubernetes/kubernetes-stain-taint-toleration.html#1

    背景:
    有时候我们要对一个node节点进行维修,升级,需要重启开关机,那怎么才能做到应用不影响呢?
    技术:
    我们可以使用 命令操作

    封锁节点,先让节点变的不可调度

    kubectl cordon <node name>
    驱逐pod,该操作做完之后就可以进行节点升级等操作

    kubectl drain <node name>
    官方文档:
    https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/
    https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#drain

    子命令

    ```bash
    Options:
    --delete-local-data=false: Continue even if there are pods using emptyDir (local data that will be deleted when
    the node is drained).
    --dry-run=false: If true, only print the object that would be sent, without sending it.
    --force=false: Continue even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet
    or StatefulSet.
    --grace-period=-1: Period of time in seconds given to each pod to terminate gracefully. If negative, the default
    value specified in the pod will be used.
    --ignore-daemonsets=false: Ignore DaemonSet-managed pods.
    --pod-selector='': Label selector to filter pods on the node
    -l, --selector='': Selector (label query) to filter on
    --timeout=0s: The length of time to wait before giving up, zero means infinite

    Usage:
    kubectl drain NODE [options]



    注意:如果执行过程中不需要驱逐 DS容器,使用–ignore-daemonsets=false
    执行之后会有error报错 ,请忽略


    解封锁

    kubectl uncordon <node name>
    之后正常使用

    如果想移除某个节点

    kubectl delete node <node name>

  • 相关阅读:
    Scratch编程:打猎(十)
    Scratch编程:漂亮的时钟(九)
    剑指offer总结一:字符、数字重复问题
    剑指offer:数值的整数次方
    剑指offer:二进制中1的个数
    InnoDB存储引擎与MyIsam存储引擎的区别
    数据库查询慢的原因
    剑指offer:矩形覆盖
    剑指offer:跳台阶问题
    redis键的过期和内存淘汰策略
  • 原文地址:https://www.cnblogs.com/cheyunhua/p/15020392.html
Copyright © 2011-2022 走看看