Merge pull request #9064 from leseb/update-toolbox-example
docs: stop pasting toolbox yaml in doc
This commit is contained in:
1 file changed
+2
-123
@@ -20,69 +20,10 @@ The toolbox can be run in two modes:
|
||||
The rook toolbox can run as a deployment in a Kubernetes cluster where you can connect and
|
||||
run arbitrary Ceph commands.
|
||||
|
||||
Save the tools spec as `toolbox.yaml`:
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: rook-ceph-tools
|
||||
namespace: rook-ceph
|
||||
labels:
|
||||
app: rook-ceph-tools
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: rook-ceph-tools
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: rook-ceph-tools
|
||||
spec:
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
containers:
|
||||
- name: rook-ceph-tools
|
||||
image: rook/ceph:master
|
||||
command: ["/tini"]
|
||||
args: ["-g", "--", "/usr/local/bin/toolbox.sh"]
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: ROOK_CEPH_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: rook-ceph-mon
|
||||
key: ceph-username
|
||||
- name: ROOK_CEPH_SECRET
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: rook-ceph-mon
|
||||
key: ceph-secret
|
||||
volumeMounts:
|
||||
- mountPath: /etc/ceph
|
||||
name: ceph-config
|
||||
- name: mon-endpoint-volume
|
||||
mountPath: /etc/rook
|
||||
volumes:
|
||||
- name: mon-endpoint-volume
|
||||
configMap:
|
||||
name: rook-ceph-mon-endpoints
|
||||
items:
|
||||
- key: data
|
||||
path: mon-endpoints
|
||||
- name: ceph-config
|
||||
emptyDir: {}
|
||||
tolerations:
|
||||
- key: "node.kubernetes.io/unreachable"
|
||||
operator: "Exists"
|
||||
effect: "NoExecute"
|
||||
tolerationSeconds: 5
|
||||
```
|
||||
|
||||
Launch the rook-ceph-tools pod:
|
||||
|
||||
```console
|
||||
kubectl create -f toolbox.yaml
|
||||
kubectl create -f cluster/examples/kubernetes/ceph/toolbox.yaml
|
||||
```
|
||||
|
||||
Wait for the toolbox pod to download its container and get to the `running` state:
|
||||
@@ -119,72 +60,10 @@ logs, you can run a script as a Kubernetes Job. The toolbox job will run a scrip
|
||||
in the job spec. The script has the full flexibility of a bash script.
|
||||
|
||||
In this example, the `ceph status` command is executed when the job is created.
|
||||
|
||||
```yaml
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: rook-ceph-toolbox-job
|
||||
namespace: rook-ceph
|
||||
labels:
|
||||
app: ceph-toolbox-job
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
initContainers:
|
||||
- name: config-init
|
||||
image: rook/ceph:master
|
||||
command: ["/usr/local/bin/toolbox.sh"]
|
||||
args: ["--skip-watch"]
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: ROOK_CEPH_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: rook-ceph-mon
|
||||
key: ceph-username
|
||||
- name: ROOK_CEPH_SECRET
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: rook-ceph-mon
|
||||
key: ceph-secret
|
||||
volumeMounts:
|
||||
- mountPath: /etc/ceph
|
||||
name: ceph-config
|
||||
- name: mon-endpoint-volume
|
||||
mountPath: /etc/rook
|
||||
containers:
|
||||
- name: script
|
||||
image: rook/ceph:master
|
||||
volumeMounts:
|
||||
- mountPath: /etc/ceph
|
||||
name: ceph-config
|
||||
readOnly: true
|
||||
command:
|
||||
- "bash"
|
||||
- "-c"
|
||||
- |
|
||||
# Modify this script to run any ceph, rbd, radosgw-admin, or other commands that could
|
||||
# be run in the toolbox pod. The output of the commands can be seen by getting the pod log.
|
||||
#
|
||||
# example: print the ceph status
|
||||
ceph status
|
||||
volumes:
|
||||
- name: mon-endpoint-volume
|
||||
configMap:
|
||||
name: rook-ceph-mon-endpoints
|
||||
items:
|
||||
- key: data
|
||||
path: mon-endpoints
|
||||
- name: ceph-config
|
||||
emptyDir: {}
|
||||
restartPolicy: Never
|
||||
```
|
||||
|
||||
Create the toolbox job:
|
||||
|
||||
```console
|
||||
kubectl create -f toolbox-job.yaml
|
||||
kubectl create -f cluster/examples/kubernetes/ceph/toolbox-job.yaml
|
||||
```
|
||||
|
||||
After the job completes, see the results of the script:
|
||||
|
||||
Reference in new issue
Block a user