admin管理员组文章数量:1794759
k8s NoSchedule k8s 设置污点 NoExecute有点复杂 移除节点 drain和不可调度cordon
驱除pod 移除节点
参考文章:www.jianshu/p/752be98e9077
# drain 移除同时驱逐 cordon 不可调度 uncordon 可调度 kubectl cordon nodename kubectl drain nodename kubectl uncordon nodename 深入分散部署案例:blog.csdn/dkfajsldfsdfsd/article/details/81173207 示例1:用反亲和特性实现pod位置协商 假设集群有五个工作节点,部署一个web应用,假设其用redis作内存缓存,共需要三个副本,通过反亲和将三个redis副本分别部署在三个不同的节点上,提高可用性,Deployment配置如下:
apiVersion: apps/v1 kind: Deployment metadata: name: redis-cache spec: selector: matchLabels: app: store replicas: 3 template: metadata: labels: app: store spec: affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: app operator: In values: - store topologyKey: "kubernetes.io/hostname" containers: - name: redis-server image: redis:3.2-alpine 设置标签污点文章:cloud.tencent/developer/article/1762009 Ⅰ、 污点 ( Taint ) 的组成 使用kubectl taint命令可以给某个Node节点设置污点,Node被设置上污点之后就和Pod之间存在了一种相斥的关系,可以让Node拒绝Pod的调度执行,甚至将Node已经存在的Pod驱逐出去 每个污点的组成如下: key=value:effect 每个污点有一个 key 和 value 作为污点的标签,其中 value 可以为空,effect 描述污点的作用。 当前 taint effect 支持如下三个选项: NoSchedule :表示k8s将不会将Pod调度到具有该污点的Node上 PreferNoSchedule :表示k8s将尽量避免将Pod调度到具有该污点的Node上 NoExecute :表示k8s将不会将Pod调度到具有该污点的Node上,同时会将Node上已经存在的Pod驱逐出去 Ⅱ、污点的设置、查看和去除 设置污点 kubectl taint nodes k8s-node2 check=yuanzhang:NoExecute 节点说明中,查找Taints字段 kubectl describe nodes k8s-node2 去除污点 kubectl taint nodes k8s-node2 check:NoExecute- 本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。
三 基础知识1 为什么K8s的master节点不允许我们的业务Pod呢?
NoSchedule : 一定不被调度 但是不会驱逐已有的 这个部署 ingress-controller 的时候 有用 PreferNoSchedule : 尽量不被调度 NoExecute : 不会调度,并且还会驱逐Node已有Pod 这个很坏 kubectl describe nodes k8s-master | grep Taints2 如何去除调度呢
#添加 尽量不调度 PreferNoSchedule kubectl taint nodes k8s-master02 node-role.kubernetes.io/master:PreferNoSchedule #去除污点NoSchedule,最后一个"-"代表删除 kubectl taint nodes k8s-master02 node-role.kubernetes.io/master:NoSchedule- 3 `#添加 尽量不调度 NoExecute 这一条策略有坑 会移除已经部署的 daementset的 pod kubectl taint nodes 10.71.8.11 node-role.kubernetes.io/master:NoExecute kubectl taint nodes 10.71.8.12 node-role.kubernetes.io/master:NoExecute- kubectl taint nodes 10.71.8.13 node-role.kubernetes.io/master:NoExecute- #去除污点NoSchedule,最后一个"-"代表删除 kubectl taint nodes 10.71.8.13 node-role.kubernetes.io/master:NoSchedule- `本文标签: 污点节点移除k8sNoSchedule
版权声明:本文标题:k8s NoSchedule k8s 设置污点 NoExecute有点复杂 移除节点 drain和不可调度cordon 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1686479528a72155.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论