Merge pull request #2749 from Bettygogo2021/member

add command for removing clusters
This commit is contained in:
KubeSphere CI Bot 2022-11-29 16:55:52 +08:00 committed by GitHub
commit a77d350194
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 29 deletions

View File

@ -1,28 +1,29 @@
---
title: "Unbind a Cluster"
title: "Remove a Member Cluster"
keywords: 'Kubernetes, KubeSphere, multicluster, hybrid-cloud'
description: 'Learn how to unbind a cluster from your cluster pool in KubeSphere.'
linkTitle: "Unbind a Cluster"
description: 'Learn how to remove a member cluster from your cluster pool in KubeSphere.'
linkTitle: "Remove a Member Cluster"
weight: 5500
---
This tutorial demonstrates how to unbind a cluster from the central control plane of KubeSphere.
This tutorial demonstrates how to remove a member cluster on the KubeSphere web console.
## Prerequisites
- You have enabled multi-cluster management.
- You need a user granted a role including the authorization of **Cluster Management**. For example, you can log in to the console as `admin` directly or create a new role with the authorization and assign it to a user.
## Unbind a Cluster
You can unbind a cluster by using either of the following methods:
## Remove a Cluster
You can remove a cluster by using either of the following methods:
**Method 1**
1. Click **Platform** in the upper-left corner and select **Cluster Management**.
2. In the **Member Clusters** area, click <img src="/images/docs/v3.3/common-icons/three-dots.png" width="15" alt="icon" /> on the right of the the cluster that you want to remove from the control plane, and then click **Unbind Cluster**.
2. In the **Member Clusters** area, click <img src="/images/docs/v3.3/common-icons/three-dots.png" width="15" alt="icon" /> on the right of the the cluster that you want to remove from the control plane, and then click **Remove Cluster**.
3. In the **Unbind Cluster** dialog box that is displayed, read the risk alert carefully. If you still want to proceed, enter the name of the member cluster, and click **OK**.
3. In the **Remove Cluster** dialog box that is displayed, read the risk alert carefully. If you still want to proceed, enter the name of the member cluster, and click **OK**.
**Method 2**
@ -32,19 +33,27 @@ You can unbind a cluster by using either of the following methods:
3. In the navigation tree on the left, select **Cluster Settings** > **Basic Information**.
4. In the **Cluster Information** area, click **Manage** > **Unbind Cluster**.
4. In the **Cluster Information** area, click **Manage** > **Remove Cluster**.
5. In the **Unbind Cluster** dialog box that is displayed, read the risk alert carefully. If you still want to proceed, enter the name of the member cluster, and click **OK**.
5. In the **Remove Cluster** dialog box that is displayed, read the risk alert carefully. If you still want to proceed, enter the name of the member cluster, and click **OK**.
{{< notice note >}}
{{< notice warning >}}
After you unbind the cluster, you cannot manage it from the control plane while Kubernetes resources on the cluster will not be deleted.
* After the member cluster has been removed, existing resources of the removed member cluster will not be automatically cleaned up.
* After the member cluster has been removed, multi-cluster configuration data of the removed member cluster will not be automatically cleaned up, which results in data loss when you uninstall KubeSphere or delete associated resources.
{{</ notice >}}
## Unbind an Unhealthy Cluster
6. Run the following command to clean up multi-cluster configuration data of the removed member cluster:
On some occasions, you cannot unbind a cluster by following the steps above. For example, you import a cluster with the wrong credentials, and you cannot access **Cluster Settings**. In this case, execute the following command to unbind an unhealthy cluster:
```bash
for ns in $(kubectl get ns --field-selector status.phase!=Terminating -o jsonpath='{.items[*].metadata.name}'); do kubectl label ns $ns kubesphere.io/workspace- && kubectl patch ns $ns --type merge -p '{"metadata":{"ownerReferences":[]}}'; done
```
## Remove an Unhealthy Cluster
On some occasions, you cannot remove a cluster by following the steps above. For example, you import a cluster with the wrong credentials, and you cannot access **Cluster Settings**. In this case, execute the following command to remove an unhealthy cluster:
```bash
kubectl delete cluster <cluster name>

View File

@ -1,29 +1,29 @@
---
title: "解绑集群"
title: "移除成员集群"
keywords: 'Kubernetes, KubeSphere, 多集群, 混合云'
description: '了解如何从 KubeSphere 的集群池中解除集群的绑定。'
linkTitle: "解绑集群"
description: '了解如何从 KubeSphere 的集群池中移除成员集群。'
linkTitle: "移除成员集群"
weight: 5500
---
本教程演示如何将集群与 KubeSphere 的中央控制平面解绑
本教程演示如何在 KubeSphere 控制台移除成员集群
## 准备工作
- 您已经启用多集群管理。
- 您需要有一个拥有**集群管理**权限角色的用户。例如,您可以直接以 `admin` 身份登录控制台,或者创建一个拥有该权限的新角色并授予至一个用户。
## 解绑集群
## 移除成员集群
你可以使用以下任一方法解绑集群:
你可以使用以下任一方法移除成员集群:
**方法 1**
1. 点击左上角的**平台管理**,选择**集群管理**。
2. 在**成员集群**区域,点击要从中央控制平面移除的集群右侧的 <img src="/images/docs/v3.3/common-icons/three-dots.png" height="20" />,点击**解绑集群**。
2. 在**成员集群**区域,点击要从中央控制平面移除的集群右侧的 <img src="/images/docs/v3.3/common-icons/three-dots.png" height="20" />,点击**移除集群**。
3. 在弹出的**解绑集群**对话框,请仔细阅读风险提示信息。如果您仍然想解绑集群,输入集群名称,点击**确定**以解绑集群。
3. 在弹出的**移除集群**对话框,请仔细阅读风险提示信息。如果您仍然想移除成员集群,输入集群名称,点击**确定**以移除成员集群。
**方法 2**
@ -33,19 +33,27 @@ weight: 5500
3. 点击**集群设置** > **基本信息**
4. 在**集群信息**右侧,点击**管理** > **解绑集群**。
4. 在**集群信息**右侧,点击**管理** > **移除集群**。
5. 在弹出的**解绑集群**对话框,请仔细阅读风险提示信息。如果您仍然想解绑集群,输入集群名称,点击**确定**以解绑集群。
5. 在弹出的**移除集群**对话框,请仔细阅读风险提示信息。如果您仍然想移除成员集群,输入集群名称,点击**确定**以移除成员集群。
{{< notice note >}}
{{< notice warning >}}
解绑集群后,您将无法在中央控制平面管理该集群,但该集群上的 Kubernetes 资源不会被删除。
* 集群被移除后,集群中原有的资源不会被自动清除。
{{</ notice >}}
* 集群被移除后,集群中原有的多集群配置数据不会被自动清除,卸载 KubeSphere 或删除关联资源时会导致用户数据丢失。
## 解绑不健康的集群
{{</ notice >}}
在某些情况下,您无法按照上述步骤解绑集群。例如,您导入了一个凭证错误的集群,并且无法访问**集群设置**。在这种情况下,请执行以下命令来解绑不健康的集群:
6. 执行以下命令手动清理被移除集群中的多集群配置数据:
```bash
for ns in $(kubectl get ns --field-selector status.phase!=Terminating -o jsonpath='{.items[*].metadata.name}'); do kubectl label ns $ns kubesphere.io/workspace- && kubectl patch ns $ns --type merge -p '{"metadata":{"ownerReferences":[]}}'; done
```
## 移除不健康的集群
在某些情况下,您无法按照上述步骤移除集群。例如,您导入了一个凭证错误的集群,并且无法访问**集群设置**。在这种情况下,请执行以下命令来移除不健康的集群:
```bash
kubectl delete cluster <cluster name>