From 3f35f06cfb2ea26f0b1c4d8118345dafc58cddc4 Mon Sep 17 00:00:00 2001 From: Jared Watts Date: Thu, 16 Feb 2017 16:52:19 -0800 Subject: [PATCH] Update toolbox container and instructions to run in Kubernetes environments --- README.md | 6 ++++++ toolbox/Dockerfile | 19 +++++++++++++---- toolbox/README.md | 46 ++++++++++++++++++++++++++++++++++++++---- toolbox/entrypoint.sh | 39 +++++++++++++++++++++++++++++++---- toolbox/rook-tools.yml | 17 ++++++++++++++++ 5 files changed, 115 insertions(+), 12 deletions(-) create mode 100644 toolbox/rook-tools.yml diff --git a/README.md b/README.md index f839d05ad..0573d81f2 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ - [What is Rook?](#what-is-rook) - [Status](#status) - [Quickstart Guides](#quickstart-guides) +- [Troubleshooting Toolbox](#troubleshooting-toolbox) - [Building](#building) - [Contributing](#contributing) - [Contact](#contact) @@ -42,6 +43,11 @@ There are a few different options for running a Rook cluster for your storage ne Once you have a Rook cluster running, you can use the `rook` tool to create and manage storage as shown in the following guide: - [Using Rook Guide](/demo/client/README.md) + +## Troubleshooting Toolbox + +We have created a toolbox container that contains a full set of commonly used debugging and troubleshooting tools. For instructions on how to run this toolbox, please see the [toolbox readme](toolbox/README.md). + ## Building See [Building](https://github.com/rook/rook/wiki/Building) in the wiki for more details. diff --git a/toolbox/Dockerfile b/toolbox/Dockerfile index 83aed97b2..a40cb1d04 100644 --- a/toolbox/Dockerfile +++ b/toolbox/Dockerfile @@ -15,19 +15,30 @@ FROM ubuntu:xenial MAINTAINER Jared Watts - -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \ +# install common tools for debugging and testing (including ceph Kraken) +RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 08b73419ac32b4e966c1a330e84ac2c0460f3994 \ + && echo "deb http://download.ceph.com/debian-kraken/ xenial main" > /etc/apt/sources.list.d/ceph-kraken.list \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \ binutils \ ceph-common \ curl \ fio \ gdb \ iperf3 \ + jq \ less \ man-db \ vim \ && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +ENV ROOK_VERSION v0.2.2 +RUN cd /tmp && \ + curl -s -L https://github.com/rook/rook/releases/download/${ROOK_VERSION}/rook-${ROOK_VERSION}-linux-amd64.tar.gz > rook.tar.gz && \ + tar xvf rook.tar.gz && \ + mv rook /usr/bin/ && \ + chown root:root /usr/bin/rook && \ + rm -fr rook* + COPY entrypoint.sh /toolbox/ -ENTRYPOINT [ "/toolbox/entrypoint.sh" ] \ No newline at end of file +ENTRYPOINT [ "/toolbox/entrypoint.sh" ] diff --git a/toolbox/README.md b/toolbox/README.md index e92e7ff54..10db0cbd0 100644 --- a/toolbox/README.md +++ b/toolbox/README.md @@ -1,7 +1,45 @@ # Rook Toolbox The rook toolbox is a container with common tools used for rook debugging and testing. All packages in the toolbox can be seen in the [Dockerfile](Dockerfile) -## Container Linux by CoreOS +## Installing more tools +The rook toolbox is based on Ubuntu, so more tools of your choosing can be easily installed with `apt-get`. For example, to install `telnet`: +``` +apt-get update +apt-get install telnet +``` + +## Running the toolbox +### Kubernetes +The rook toolbox can run as a pod in a Kubernetes cluster. First, ensure you have a running Kubernetes cluster with rook deployed (instructions can be found in the [Rook on Kubernetes readme](../demo/kubernetes/README.md)). + +From this directory, launch the rook-tools pod: +``` +kubectl create -f rook-tools.yml +``` + +Wait for the toolbox pod to download its container and get to the `running` state: +``` +kubectl -n rook get pod rook-tools +``` + +Once the rook-tools pod is running, you can connect to it with: +``` +kubectl -n rook exec -it rook-tools bash +``` + +All available tools in the toolbox are ready for your troubleshooting needs. Example: +``` +rook status +ceph df +rados df +``` + +When you are completely done with the toolbox, you can clean it up by running: +``` +kubectl delete -f rook-tools.yml +``` + +### Container Linux by CoreOS To use the rook toolbox on CoreOS, first add the following values to the toolbox config file: ``` cat >~/.toolboxrc <> ~/.bashrc + +export ROOK_API_SERVER_ENDPOINT=${ROOK_API_SERVER_ENDPOINT} + +EOF + + CLIENT_INFO=$(curl -s http://${ROOK_API_SERVER_ENDPOINT}/client) + MON_ENDPOINTS=$(echo $CLIENT_INFO | jq -r '.monAddresses[]' | awk -F '/' 'BEGIN { ORS="," }; {print $1}' | sed 's/,$//') + KEYRING_FILE="/etc/ceph/keyring" + + cat < ${CEPH_CONFIG} +[global] +mon_host = ${MON_ENDPOINTS} + +[client.admin] +keyring = ${KEYRING_FILE} +EOF + + cat < ${KEYRING_FILE} +[client.admin] +key = ${ROOKD_ADMIN_SECRET} +EOF fi -exec ${ARGS} \ No newline at end of file +exec ${ARGS} diff --git a/toolbox/rook-tools.yml b/toolbox/rook-tools.yml new file mode 100644 index 000000000..cec2b4b77 --- /dev/null +++ b/toolbox/rook-tools.yml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Pod +metadata: + name: rook-tools + namespace: rook +spec: + containers: + - name: rook-tools + image: quay.io/rook/toolbox:latest + imagePullPolicy: IfNotPresent + args: ["sleep", "36500d"] + env: + - name: ROOKD_ADMIN_SECRET + valueFrom: + secretKeyRef: + name: mon + key: admin-secret