All Projects → rancher → system-tools

rancher / system-tools

Licence: Apache-2.0 License
This repo is for tools helping with various cleanup tasks for rancher projects. Example: rancher installation cleanup

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects

system-tools

Rancher 2.0 operations tool kit.

Commands

Remove

Usage:

   system-tools remove [command options] [arguments...]

Options:

  • --kubeconfig value, -c value: kubeconfig absolute path [$KUBECONFIG]
  • --namespace cattle-system, -n cattle-system: rancher 2.x deployment namespace. default is cattle-system (default: "cattle-system")
  • --force: Skip the the interactive removal confirmation and remove the Rancher deployment right away.

The system-tools remove command is used to delete a Rancher 2.x management plane deployment. It operates by applying the following steps:

  • Remove Rancher Deployment.
  • Remove Rancher-Labeled ClusterRoles and ClusterRoleBindings.
  • Remove Labels, Annotations and Finalizers from all resources on the management plane cluster.
  • Remove Machines, Clusters, Projects and Users CRDs and corresponding namespaces.
  • Remove all resources created under the management.cattle.io API group.
  • Reamove all CRDs created by Rancher 2.x.
  • Remove the Rancher deployment Namespace, default is cattle-system.

Logs

Usage:

   system-tools logs [command options] [arguments...]

Options:

  • --kubeconfig value, -c value: managed cluster kubeconfig [$KUBECONFIG]
  • --output value, -o value: cluster logs tarball (default: "cluster-logs.tar")
  • --node value, -n value: fetch logs for a single node

The system-tools logs command is used to pull Kubernetes components' Docker container logs deployed by RKE on cluster nodes.

The command works by deploying a DaemonSet on the managed cluster, that uses the Rancher node-agent image to mount RKE logs directory and tar the logs on each node and stream them the host running system-tools. Once the the logs are pulled, the DaemonSet is removed automatically.

It's also possible to use the --node option to pull logs from a specific node.

Stats

Usage:

   system-tools stats [command options] [arguments...]

Options:

  • --kubeconfig value, -c value: managed cluster kubeconfig [$KUBECONFIG]
  • --node value, -n value: show stats for a single node
  • --stats-command value, -s value: alternative command to run on the servers (default: "/usr/bin/sar -u -r -F 1 1")

The system-tools stats command is used to pull real-time stats from Rancher-Managed Kubernetes cluster nodes. The default is to pull CPU, memory and disk usage stats.

The command works by deploying a DaemonSet on the managed cluster, that uses the Rancher node-agent to run pods used to execute the stats command on each node. Stats are displayed live every 5 seconds. The tool keeps running until the user interrupts its execution using ctrl+c which will trigger a cleanup command and remove the stats DaemonSet.

It's also possible to monitor a single node with the --node option or run another stats command using the --stats-command option.

Building

make

Running

./bin/system-tools

License

Copyright (c) 2018 Rancher Labs, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].