Merge pull request #406 from jbw976/toolbox-k8s
Update toolbox container and instructions to run in Kubernetes enviro…
This commit is contained in:
commit
a1bfd7cebe
5 files changed
+115
-12
No files matched your search
@@ -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.
|
||||
|
||||
+15
-4
@@ -15,19 +15,30 @@
|
||||
FROM ubuntu:xenial
|
||||
MAINTAINER Jared Watts <jared.watts@quantum.com>
|
||||
|
||||
|
||||
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" ]
|
||||
ENTRYPOINT [ "/toolbox/entrypoint.sh" ]
|
||||
+42
-4
@@ -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 <<EOL
|
||||
@@ -15,7 +53,7 @@ Then launch the toolbox as usual:
|
||||
toolbox
|
||||
```
|
||||
|
||||
### Ceph Tools
|
||||
#### Ceph Tools
|
||||
To use the ceph tools from a rook host, launch the toolbox with the following options:
|
||||
```
|
||||
toolbox --bind=/var/lib/rook:/var/lib/rook /toolbox/entrypoint.sh
|
||||
@@ -26,13 +64,13 @@ ceph df
|
||||
rados df
|
||||
```
|
||||
|
||||
## Other Linux Distros
|
||||
### Other Linux Distros
|
||||
The rook toolbox container can simply be run directly with `docker` on other Linux distros:
|
||||
```
|
||||
docker run -it quay.io/rook/toolbox
|
||||
```
|
||||
|
||||
### Ceph Tools
|
||||
#### Ceph Tools
|
||||
To run ceph tools such as `ceph` and `rados`, run the container with the following options:
|
||||
```
|
||||
docker run -it --network=host -v /var/lib/rook:/var/lib/rook quay.io/rook/toolbox
|
||||
|
||||
+35
-4
@@ -19,15 +19,46 @@ if [ $# -eq 0 ]; then
|
||||
ARGS=/bin/bash
|
||||
fi
|
||||
|
||||
# find one of rook's ceph config files and copy it to the default location so ceph/rados tools
|
||||
# can be used without specifying a config file path
|
||||
ROOK_DIR="/var/lib/rook"
|
||||
CEPH_CONFIG="/etc/ceph/ceph.conf"
|
||||
|
||||
# attempt to create a ceph config file in its default location so ceph/rados tools can be used
|
||||
# without specifying any arguments
|
||||
if [[ -d ${ROOK_DIR} ]]; then
|
||||
# there is a rook directory, try to find one of rook's ceph config files and copy it
|
||||
ROOK_CONFIG=`find ${ROOK_DIR} -regex '.*mon[0-9]+/.*\.config' | head -1`
|
||||
if [[ ! -z ${ROOK_CONFIG} ]]; then
|
||||
mkdir -p /etc/ceph
|
||||
cp ${ROOK_CONFIG} /etc/ceph/ceph.conf
|
||||
cp ${ROOK_CONFIG} ${CEPH_CONFIG}
|
||||
fi
|
||||
elif [[ ! -z ${ROOK_API_SERVICE_HOST} ]] && [[ ! -z ${ROOK_API_SERVICE_PORT} ]]; then
|
||||
# we have some rook env vars set, get client info from the rook API server and construct
|
||||
# a ceph config file from that
|
||||
ROOK_API_SERVER_ENDPOINT=${ROOK_API_SERVICE_HOST}:${ROOK_API_SERVICE_PORT}
|
||||
|
||||
# append to the bashrc file so that the rook tool can find the API server easily
|
||||
cat <<EOF >> ~/.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 <<EOF > ${CEPH_CONFIG}
|
||||
[global]
|
||||
mon_host = ${MON_ENDPOINTS}
|
||||
|
||||
[client.admin]
|
||||
keyring = ${KEYRING_FILE}
|
||||
EOF
|
||||
|
||||
cat <<EOF > ${KEYRING_FILE}
|
||||
[client.admin]
|
||||
key = ${ROOKD_ADMIN_SECRET}
|
||||
EOF
|
||||
fi
|
||||
|
||||
exec ${ARGS}
|
||||
exec ${ARGS}
|
||||
@@ -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
|
||||
Reference in new issue
Block a user