当您耗尽Kubernetes集群中的节点时会发生什么? [英] What happens when you drain nodes in a Kubernetes cluster?

查看:89
本文介绍了当您耗尽Kubernetes集群中的节点时会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您耗尽Kubernetes集群中的节点时,我想澄清一些维护准备工作:

I'd like to get some clarification for preparation for maintenance when you drain nodes in a Kubernetes cluster:

这是我在运行kubectl drain MY_NODE时所知道的:

Here's what I know when you run kubectl drain MY_NODE:

  • 节点被封锁
  • Pod已正常关闭
  • 您可以选择忽略Daemonset吊舱,因为如果将其关闭,它们将立即重新生成.

我对节点耗尽时会发生什么感到困惑.

I'm confused as to what happens when a node is drained though.

问题:

  • 豆荚怎么办?据我所知,Kubernetes中没有Pod的实时迁移".
  • 是否会关闭Pod,然后在另一个节点上自动启动它?还是这取决于我的配置? (即,是否可以通过排水关闭吊舱,而不在其他节点上启动该吊舱)

我希望对此有所澄清,以及任何最佳做法或建议.预先感谢.

I would appreciate some clarification on this and any best practices or advice as well. Thanks in advance.

推荐答案

我只想向 eamon1234 的答案:

您可能会发现它也很有用:

You may find this useful as well:

  1. 链接到官方文件(在情况下默认标志更改等).根据它:

  1. Link to official docummentation (in case default flags change etc.). According to it:

'drain'逐出或删除除镜像pod之外的所有pod( 无法通过API服务器删除).如果有 由DaemonSet管理的广告连播,如果没有 --ignore-daemonsets,并且无论它不会删除任何由DaemonSet管理的Pod,因为这些Pod会立即 替换为DaemonSet控制器,该控制器会忽略无法计划的 标记.如果有既不是镜像容器又不是镜像容器的容器 由ReplicationController,ReplicaSet,DaemonSet,StatefulSet管理 或Job,则除非您使用--force,否则排水将不会删除任何吊舱. 如果缺少一个或多个Pod的管理资源,--force也将允许删除操作继续进行.

The 'drain' evicts or deletes all pods except mirror pods (which cannot be deleted through the API server). If there are DaemonSet-managed pods, drain will not proceed without --ignore-daemonsets, and regardless it will not delete any DaemonSet-managed pods, because those pods would be immediately replaced by the DaemonSet controller, which ignores unschedulable markings. If there are any pods that are neither mirror pods nor managed by ReplicationController, ReplicaSet, DaemonSet, StatefulSet or Job, then drain will not delete any pods unless you use --force. --force will also allow deletion to proceed if the managing resource of one or more pods is missing.

  • 简单的图表说明了使用kubectl drain时实际发生的情况.

  • Simple chart illustrating what actually happens when using kubectl drain.

    kubectl drain--dry-run选项一起使用也可能是一个好主意,因此您可以在应用任何实际更改之前先查看其结果,例如:

    Using kubectl drain with --dry-run option may be also a good idea so you can see its outcome before any actual changes are applied e.g.:

    kubectl drain foo --force --dry-run

    但是,它不会显示有关现有本地数据或守护程序集的任何错误,您可以使用--dry-run标志来查看这些错误: ... error: cannot delete DaemonSet-managed Pods (use --ignore-daemonsets to ignore) ...

    however it will not show any errors about existing local data or daemonsets which you can see whithout using --dry-run flag: ... error: cannot delete DaemonSet-managed Pods (use --ignore-daemonsets to ignore) ...

    这篇关于当您耗尽Kubernetes集群中的节点时会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆