From 4da6ab9d23c1e096dcc3b73501520b077798ea58 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Steenis Date: Tue, 26 Mar 2019 00:30:07 +0100 Subject: [PATCH] Add System Tools --- .../v2.x/en/removing-rancher/_index.md | 81 +----------- .../rancher/v2.x/en/system-tools/_index.md | 118 ++++++++++++++++++ 2 files changed, 119 insertions(+), 80 deletions(-) create mode 100644 content/rancher/v2.x/en/system-tools/_index.md diff --git a/content/rancher/v2.x/en/removing-rancher/_index.md b/content/rancher/v2.x/en/removing-rancher/_index.md index 9833e07ceb5..e7f11cc45a4 100644 --- a/content/rancher/v2.x/en/removing-rancher/_index.md +++ b/content/rancher/v2.x/en/removing-rancher/_index.md @@ -10,84 +10,5 @@ aliases: When you deploy Rancher and use it to provision clusters, Rancher installs its components on the nodes you use. There are two contexts in which you'd remove Rancher from a Kubernetes cluster node. -- **Removing Rancher from Your Rancher Server Nodes**: In this context, you are removing Rancher from the Kubernetes cluster that you configured for your [Rancher installation]({{< baseurl >}}/rancher/v2.x/en/installation/ha/). This is outlined below. +- **[Removing Rancher from Your Rancher Server Nodes]({{< baseurl >}}/rancher/v2.x/en/system-tools/#remove)**: In this context, you are removing Rancher from the Kubernetes cluster that you configured for your [Rancher installation]({{< baseurl >}}/rancher/v2.x/en/installation/ha/). This can be done using [System Tools]({{< baseurl >}}/rancher/v2.x/en/system-tools/). - **[Removing Rancher Components from Rancher Launched Kubernetes Clusters]({{< baseurl >}}/rancher/v2.x/en/admin-settings/removing-rancher/user-cluster-nodes/)**: In this context, you are removing Rancher components from Kubernetes clusters that you [launched using Rancher]({{< baseurl >}}/rancher/v2.x/en/cluster-provisioning/rke-clusters/). - -## Removing Rancher from a Rancher Installation - -When you want to remove Rancher from your [installation cluster]({{< baseurl >}}/rancher/v2.x/en/installation/ha/) as part of a Rancher reinstall (or uninstall), follow the instructions below to download and run _system-tools_, a utility that removes all Rancher components from Rancher Server nodes provisioned by RKE. - -### 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 running the tool from. - -Operating System | File ------------------|----- -MacOS | `system-tools_darwin-amd64` -Linux | `system-tools_linux-amd64` -Windows | `system-tools_windows-amd64.exe` - -
- -After you download the tools, complete the following actions: - -1. Rename the file to `system-tools`. - -1. Give the file executable permissions by running the following command: - - ``` - chmod +x system-tools - ``` -1. Find the kubeconfig file that was generated during your Rancher installation, `kube_config_rancher-cluster.yml`. Move it to the `~/.kube` on your workstation, if it isn't already there. Create this directory if it doesn't exist. - - System-tools uses this file to access your installation cluster. - - -### Using the System-Tool - -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` and kubeconfig file to your workstation's `~/.kube` directory, you can run system-tools by changing to the `~/.kube` directory and entering the following command. - ->**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 -``` - -
-When you run this command, the components listed in [What Gets Removed?](#what-gets-removed) are deleted. - - -##### Options - -| Option | Description | -| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| `--kubeconfig , -c ` | The cluster's kubeconfig file absolute path, usually `~/.kube/kube_config_rancher-cluster.yml`.1 | -| `--namespace , -n cattle-system` | Rancher 2.x deployment namespace (``). If no namespace is defined, the options defaults to `cattle-system`. | -| `--force` | Skips the the interactive removal confirmation and removes the Rancher deployment without prompt. | - -> 1 If you are working with multiple Kubernetes clusters, you can place `kube_config_rancher-cluster.yml` in another directory path and then set the `KUBECONFIG` environment variable to its path. ->``` ->export KUBECONFIG=$(pwd)/kube_config_rancher-cluster.yml ->``` - -## What Gets Removed? - -When removing Rancher from server nodes launched using RKE, the following components are deleted. - - -- The Rancher deployment namespace (`cattle-system` by default). -- Any `serviceAccount`, `clusterRoles`, and `clusterRoleBindings` that Rancher applied the `cattle.io/creator:norman` label to. Rancher applies this label to any resource that it creates as of v2.1.0. -- 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. - - ->**Using 2.0.8 or Earlier?** -> ->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. diff --git a/content/rancher/v2.x/en/system-tools/_index.md b/content/rancher/v2.x/en/system-tools/_index.md new file mode 100644 index 00000000000..2856637d961 --- /dev/null +++ b/content/rancher/v2.x/en/system-tools/_index.md @@ -0,0 +1,118 @@ +--- +title: System Tools +weight: 6001 +--- + +System Tools is a tool to perform operational tasks on [Rancher Launched Kubernetes]({{< baseurl >}}/rancher/v2.x/en/cluster-provisioning/rke-clusters/) clusters or [RKE cluster as used for Rancher HA]({{< baseurl >}}/rancher/v2.x/en/installation/ha/kubernetes-rke/). The tasks include: + +* Collect logging and system metrics from nodes. +* Remove Kubernetes resources created by Rancher. + +### Download System Tools + +You can download the latest version of System Tools from the [GitHub releases page](https://github.com/rancher/system-tools/releases/latest). Download the version of `system-tools` for the OS that you are using to interact with the cluster. + +Operating System | Filename +-----------------|----- +MacOS | `system-tools_darwin-amd64` +Linux | `system-tools_linux-amd64` +Windows | `system-tools_windows-amd64.exe` + +After you download the tools, complete the following actions: + +1. Rename the file to `system-tools`. + +1. Give the file executable permissions by running the following command: + + > **Using Windows?** + The file is already an executable, you can skip this step. + + ``` + chmod +x system-tools + ``` + +### Using System Tools + +The following subcommands are available: + +| Command | Description +|---|--- +| [logs](#logs) | Collect Kubernetes cluster component logs from nodes. +| [stats](#stats) | Stream system metrics from nodes. +| [remove](#remove) | Remove Kubernetes resources created by Rancher. + +### Logs + +The logs subcommand will collect log files of core Kubernetes cluster components from nodes in [Rancher Launched Kubernetes]({{< baseurl >}}/rancher/v2.x/en/cluster-provisioning/rke-clusters/) clusters or [RKE cluster as used for Rancher HA]({{< baseurl >}}/rancher/v2.x/en/installation/ha/kubernetes-rke/). See [Troubleshooting]({{< baseurl >}}//rancher/v2.x/en/troubleshooting/) for a list of core Kubernetes cluster components. + +System Tools will use the provided kubeconfig file to deploy a DaemonSet, that will copy all the logfiles from the core Kubernetes cluster components and add them to a single tar file (`cluster-logs.tar` by default). If you only want to collect logging from a single node, you can specify the node by using `--node NODENAME` or `-n NODENAME`. + +#### Usage + +``` +./system-tools_darwin-amd64 logs --kubeconfig +``` + +#### Options + +| Option | Description +| ------------------------------------------------------ | ------------------------------------------------------ +| `--kubeconfig , -c ` | The cluster's kubeconfig file. +| `--output , -o cluster-logs.tar` | Name of the created tarball containing the logs. If no output filename is defined, the options defaults to `cluster-logs.tar`. +| `--node , -n node1` | Specify the nodes to collect the logs from. If no node is specified, logs from all nodes in the cluster will be collected. + +### Stats + +The stats subcommand will display system metrics from nodes in [Rancher Launched Kubernetes]({{< baseurl >}}/rancher/v2.x/en/cluster-provisioning/rke-clusters/) clusters or [RKE cluster as used for Rancher HA]({{< baseurl >}}/rancher/v2.x/en/installation/ha/kubernetes-rke/). + +System Tools will deploy a DaemonSet, and run a predefined command based on `sar` (System Activity Report) to show system metrics. + +#### Usage + +``` +./system-tools_darwin-amd64 stats --kubeconfig +``` + +#### Options + +| Option | Description +| ------------------------------------------------------ | ------------------------------ +| `--kubeconfig , -c ` | The cluster's kubeconfig file. +| `--node , -n node1` | Specify the nodes to display the system metrics from. If no node is specified, logs from all nodes in the cluster will be displayed. +| `--stats-command value, -s value` | The command to run to display the system metrics. If no command is defined, the options defaults to `/usr/bin/sar -u -r -F 1 1`. + +### Remove + +When you install Rancher on a Kubernetes cluster, it will create Kubernetes resources to run and to store configuration data. If you want to remove Rancher from your cluster, you can use the remove subcommand to remove the Kubernetes resources. When you use the remove subcommand, the following resources will be removed: + +>**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. + +- The Rancher deployment namespace (`cattle-system` by default). +- Any `serviceAccount`, `clusterRoles`, and `clusterRoleBindings` that Rancher applied the `cattle.io/creator:norman` label to. Rancher applies this label to any resource that it creates as of v2.1.0. +- 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.x. + +>**Using 2.0.8 or Earlier?** +> +>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. + +#### Usage + +When you run the command below, all the resources listed [above](#remove) will be removed from the cluster. + +>**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 --namespace +``` + +#### Options + +| Option | Description +| ---------------------------------------------- | ------------ +| `--kubeconfig , -c ` | The cluster's kubeconfig file +| `--namespace , -n cattle-system` | Rancher 2.x deployment namespace (``). If no namespace is defined, the options defaults to `cattle-system`. +| `--force` | Skips the the interactive removal confirmation and removes the Rancher deployment without prompt.