mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-25 04:28:15 +00:00
making edit's based on Mohamed's feedback
This commit is contained in:
@@ -3,7 +3,7 @@ title: Removing Rancher
|
||||
weight: 5000
|
||||
---
|
||||
|
||||
When you deploy Rancher and use it to provision clusters, Rancher installs its components on the nodes you use. This section features instructions on how to clean Rancher's components from your nodes that you no longer want to use with Rancher.
|
||||
When you deploy Rancher and use it to provision clusters, Rancher installs its components on the nodes you use. This section features instructions on how to remove Rancher's components from your nodes that you no longer want to use with Rancher.
|
||||
|
||||
There are two contexts in which you'd remove Rancher from a Kubernetes cluster node.
|
||||
|
||||
|
||||
+13
-10
@@ -12,7 +12,7 @@ For clusters nodes provisioned using [RKE](({{< baseurl >}}/rancher/v2.x/en/clus
|
||||
|
||||
### Download and Configuration
|
||||
|
||||
You can download the latest version of Rancher system-tools from its GitHub [releases page](https://github.com/rancher/system-tools/releases). Download the version of system-tools for the OS that you're removing Rancher from.
|
||||
You can download the latest version of Rancher system-tools from its GitHub [releases page](https://github.com/rancher/system-tools/releases). Download the version of system-tools for the OS that you're running the tool from.
|
||||
|
||||
Operating System | File
|
||||
-----------------|-----
|
||||
@@ -22,7 +22,7 @@ Windows | `system-tools_windows-amd64.exe`
|
||||
|
||||
<br>
|
||||
|
||||
After you download the tools, move it onto the node you're removing Rancher from, and then complete the following actions:
|
||||
After you download the tools, complete the following actions:
|
||||
|
||||
1. Rename the file to `system-tools`.
|
||||
|
||||
@@ -31,16 +31,21 @@ After you download the tools, move it onto the node you're removing Rancher from
|
||||
```
|
||||
chmod +x system-tools
|
||||
```
|
||||
1. Download the Kubeconfig File for your Rancher installation cluster and place it in the `/.kube/config` on your workstation. System-tools uses this file to access your installation cluster.
|
||||
|
||||
For instructions on how to download the Kubeconfig file, see [Accessing Clusters with kubectl and a kubeconfig File]({{< baseurl >}}rancher/v2.x/en/k8s-in-rancher/kubectl/#accessing-clusters-with-kubectl-and-a-kubeconfig-file).
|
||||
|
||||
1. Move `system-tools` to the same directory as the kubeconfig file: `/.kube/config`.
|
||||
|
||||
### Using the System-Tool
|
||||
|
||||
System-tools is a utility that cleans up Rancher. In this use case, it will help you remove the Rancher from your cluster nodes.
|
||||
System-tools is a utility for running operational tasks on Rancher clusters. In this use case, it will help you remove the Rancher from your installation nodes.
|
||||
|
||||
#### Usage
|
||||
|
||||
After you move the `system-tools` file to your Rancher node, you can run it by changing to the file's directory and running the following command.
|
||||
After you move the `system-tools` and kubeconfig file to your workstation's `/.kube/config` directory, you can run system-tools by changing to the `/.kube/config` directory and entering the following command.
|
||||
|
||||
>**Warning:** This command will remove data from your nodes. Make sure you have created a backup of files you want to keep before executing the command, as data will be lost.
|
||||
>**Warning:** This command will remove data from your etcd nodes. Make sure you have created a [backup of etcd]({{< baseurl >}}/rancher/v2.x/en/backups/backups) before executing the command.
|
||||
|
||||
```
|
||||
./system-tools remove --kubeconfig <$KUBECONFIG> --namespace <NAMESPACE>
|
||||
@@ -86,9 +91,7 @@ Rather than cleaning imported cluster nodes using the Rancher UI, you can run a
|
||||
|
||||
1. Open a web browser, navigate to [GitHub](https://github.com/rancher/rancher/blob/master/cleanup/user-cluster.sh), and download `user-cluster.sh`.
|
||||
|
||||
1. Open kubectl.
|
||||
|
||||
1. Using kubectl, make the script executable by running the following command from the same directory as `user-cluster.sh`:
|
||||
1. Make the script executable by running the following command from the same directory as `user-cluster.sh`:
|
||||
|
||||
```
|
||||
chmod +x user-cluster.sh
|
||||
@@ -132,6 +135,6 @@ When cleaning nodes provisioned using Rancher, the following components are dele
|
||||
[3]: {{< baseurl >}}/rancher/v2.x/en/cluster-provisioning/hosted-kubernetes-clusters/
|
||||
[4]: {{< baseurl >}}/rancher/v2.x/en/cluster-provisioning/imported-clusters/
|
||||
|
||||
>**Using 2.0.7 or Earlier?**
|
||||
>**Using 2.0.8 or Earlier?**
|
||||
>
|
||||
>These versions of Rancher do not automatically delete the `serviceAccount`, `clusterRole`, and `clusterRole` resources after the job runs. You'll have to delete them yourself.
|
||||
>These versions of Rancher do not automatically delete the `serviceAccount`, `clusterRole`, and `clusterRoleBindings` resources after the job runs. You'll have to delete them yourself.
|
||||
@@ -10,6 +10,25 @@ When you use Rancher to [provision nodes for a cluster]({{< baseurl >}}rancher/v
|
||||
|
||||
When removing nodes from your Rancher-provisioned cluster (provided that they are in `Active` state), those resources automatically cleaned, and the only action needed is to restart the node. When a node has become unreachable and the automatic cleanup process cannot be used, we describe the steps that need to be executed before the node can be added to a cluster again.
|
||||
|
||||
## What Gets Removed?
|
||||
|
||||
When cleaning nodes provisioned using Rancher, the following components are deleted based on the type of cluster node you're removing.
|
||||
|
||||
| Removed Component | [IaaS Nodes][1] | [Custom Nodes][2] | [Hosted Cluster][3] | [Imported Nodes][4] |
|
||||
| ------------------------------------------------------------------------------ | --------------- | ----------------- | ------------------- | ------------------- |
|
||||
| The Rancher deployment namespace (`cattle-system` by default) | ✓ | ✓ | ✓ | ✓ |
|
||||
| `serviceAccount`, `clusterRoles`, and `clusterRoleBindings` labeled by Rancher | ✓ | ✓ | ✓ | ✓ |
|
||||
| Labels, Annotations, and Finalizers | ✓ | ✓ | ✓ | ✓ |
|
||||
| Rancher Deployment | ✓ | ✓ | ✓ | |
|
||||
| Machines, clusters, projects, and user custom resource deployments (CRDs) | ✓ | ✓ | ✓ | |
|
||||
| All resources create under the `management.cattle.io` API Group | ✓ | ✓ | ✓ | |
|
||||
| All CRDs created by Rancher v2.0.x | ✓ | ✓ | ✓ | |
|
||||
|
||||
[1]: {{< baseurl >}}/rancher/v2.x/en/cluster-provisioning/rke-clusters/node-pools/
|
||||
[2]: {{< baseurl >}}/rancher/v2.x/en/cluster-provisioning/rke-clusters/custom-nodes/
|
||||
[3]: {{< baseurl >}}/rancher/v2.x/en/cluster-provisioning/hosted-kubernetes-clusters/
|
||||
[4]: {{< baseurl >}}/rancher/v2.x/en/cluster-provisioning/imported-clusters/
|
||||
|
||||
## Removing A Node from a Cluster by Rancher UI
|
||||
|
||||
When the node is in `Active` state, removing the node from a cluster will trigger a process to clean up the node. Please restart the node after the automatic cleanup process is done to make sure any non-persistent data is properly removed.
|
||||
@@ -30,6 +49,60 @@ When a node is unreachable and removed from the cluster, the automatic cleaning
|
||||
|
||||
>**Warning:** The commands listed below will remove data from the node. Make sure you have created a backup of files you want to keep before executing any of the commands as data will be lost.
|
||||
|
||||
## Imported Cluster Nodes
|
||||
|
||||
For imported clusters, the process for removing Rancher from its nodes is a little different. You can the option of simply deleting the cluster in the Rancher UI, or your can run a script that removes Rancher components from the nodes. Both options make the same deletions.
|
||||
|
||||
{{% tabs %}}
|
||||
{{% tab "By UI / API" %}}
|
||||
>**Warning:** This process will remove data from your nodes. Make sure you have created a backup of files you want to keep before executing the command, as data will be lost.
|
||||
|
||||
After you initiate the removal of an [imported cluster]({{< baseurl >}}/rancher/v2.x/en/cluster-provisioning/#import-existing-cluster) using the Rancher UI (or API), the following events occur.
|
||||
|
||||
1. Rancher creates a `serviceAccount` that it uses to remove the cluster. This account is assigned the [clusterRole](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-and-clusterrole) and [clusterRoleBinding](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#rolebinding-and-clusterrolebinding) permissions, which are required to remove the cluster.
|
||||
|
||||
1. Using the `serviceAccount`, Rancher schedules and runs a [job](https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/) that cleans the Rancher and Kubernetes components off of the node. This job also references the `serviceAccount` and its roles as dependencies, so the job deletes them before its completion.
|
||||
|
||||
1. Rancher is removed from the cluster nodes. However, the cluster persists, running the native version of Kubernetes.
|
||||
|
||||
**Result:** All components listed for imported clusters in [What Gets Removed?](#what-gets-removed) are deleted.
|
||||
|
||||
{{% /tab %}}
|
||||
{{% tab "By Script" %}}
|
||||
Rather than cleaning imported cluster nodes using the Rancher UI, you can run a script instead.
|
||||
|
||||
>**Prerequisite:**
|
||||
>
|
||||
>Install [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/).
|
||||
|
||||
1. Open a web browser, navigate to [GitHub](https://github.com/rancher/rancher/blob/master/cleanup/user-cluster.sh), and download `user-cluster.sh`.
|
||||
|
||||
1. Make the script executable by running the following command from the same directory as `user-cluster.sh`:
|
||||
|
||||
```
|
||||
chmod +x user-cluster.sh
|
||||
```
|
||||
|
||||
1. **Air Gap Users Only:** Open `user-cluster.sh` and replace `yaml_url` with the URL in `user-cluster.yml`.
|
||||
|
||||
If you aren't an air gap user, skip this step.
|
||||
|
||||
1. From the same directory, run the script:
|
||||
|
||||
>**Tip:**
|
||||
>
|
||||
>Add the `-dry-run` flag to preview the script's outcome without making changes.
|
||||
|
||||
```
|
||||
./user-cluster.sh rancher/agent:latest
|
||||
```
|
||||
|
||||
**Result:** The script runs. All components listed for imported clusters in [What Gets Removed?](#what-gets-removed) are deleted.
|
||||
|
||||
{{% /tab %}}
|
||||
{{% /tabs %}}
|
||||
|
||||
|
||||
### Docker Containers, Images, and Volumes
|
||||
|
||||
Based on what role you assigned to the node, Kubernetes components in containers, containers belonging to overlay networking, DNS, ingress controller and Rancher agent. (and pods you created that have been scheduled to this node)
|
||||
|
||||
Reference in New Issue
Block a user