website/content/zh/docs/v4.1/03-installation-and-upgrade/05-add-and-delete-cluster-n.../02-delete-cluster-nodes.adoc
zhuxiujuan28 ff10ded70a fix 4.1 conflicts
Signed-off-by: zhuxiujuan28 <562873187@qq.com>
2024-09-11 09:56:32 +08:00

106 lines
3.1 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "删除集群节点"
linkTitle: "删除集群节点"
keywords: "Kubernetes, KubeSphere, 删除集群节点"
description: "介绍如何删除 KubeSphere 集群节点。"
weight: 02
---
本节介绍如何删除{ks_product_both}集群节点。
节点删除过程中将用到开源工具 KubeKey。有关 KubeKey 的更多信息,请访问 link:https://github.com/kubesphere/kubekey[GitHub KubeKey 仓库]。
// Note
include::../../../../_ks_components/admonitions/note.adoc[]
本节介绍的节点删除方式仅适用于 Kubernetes 通过 KubeKey 安装的场景。如果您的 Kubernetes 不是通过 KubeKey 安装,请参阅 link:https://kubernetes.io/zh/docs/concepts/architecture/nodes/[Kubernetes 官方文档]删除节点。
include::../../../../_ks_components/admonitions/admonEnd.adoc[]
// Warning
include::../../../../_ks_components/admonitions/warning.adoc[]
* 请勿删除控制平面节点,否则集群将出现错误。
* 请确保节点删除后,集群中剩余的资源仍然足够运行现有的业务。否则,节点删除后可能会出现业务中断。
include::../../../../_ks_components/admonitions/admonEnd.adoc[]
== 前提条件
:relfileprefix: ../../../
您需要获取安装配置文件 **config-sample.yaml** 并将其传输到用于执行本节操作的集群节点。有关更多信息请参阅xref:03-installation-and-upgrade/02-install-kubesphere/02-install-kubernetes-and-kubesphere.adoc[安装 Kubernetes 和 KubeSphere]。
:relfileprefix: ./
--
// Warning
include::../../../../_ks_components/admonitions/warning.adoc[]
如果您无法获取安装配置文件 **config-sample.yaml**您需要参阅link:../../02-install-kubesphere/02-install-kubernetes-and-kubesphere/[安装 Kubernetes 和 KubeSphere] 重新创建 **config-sample.yaml** 文件。重新创建该文件时,请务必确保文件中的集群信息与集群的当前实际情况一致。否则,删除节点后集群可能会出现错误。
include::../../../../_ks_components/admonitions/admonEnd.adoc[]
--
== 操作步骤
// ifeval::["{file_output_type}" == "pdf"]
// include::../../../_custom/installationAndUpgrade/installationAndUpgrade-oper-decompressInstallationPackage_new.adoc[]
// endif::[]
// ifeval::["{file_output_type}" == "html"]
include::../../../_custom/installationAndUpgrade/installationAndUpgrade-oper-downloadKubekey.adoc[]
// endif::[]
. 执行以下命令查看需要删除的节点的名称:
+
--
// Bash
[,bash]
----
kubectl get node
----
--
. 执行以下命令将需要删除的节点上运行的容器组驱逐到其他节点(将 <node name> 替换为需要删除的节点的名称):
+
--
// Bash
[,bash]
----
kubectl drain <node name>
----
--
+
include::../../../_custom/installationAndUpgrade/installationAndUpgrade-oper-transferConfig.adoc[]
+
. 执行以下命令开始删除节点:
+
--
// Bash
[,bash]
----
 ./kk delete node <node name> -f config-sample.yaml
----
--
. 执行以下命令查看当前集群节点:
+
--
// Bash
[,bash]
----
kubectl get node
----
如果没有显示已删除节点的信息,则表明节点删除成功。
--