You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+52-51
Original file line number
Diff line number
Diff line change
@@ -1,96 +1,99 @@
1
1
# kube-runner
2
2
3
-
This repository provides a tool for running bioinformatics workflows as jobs on a Kubernetes cluster. This repository also contains some examples for several applications:
3
+
This repository provides scripts for running nextflow pipelines on a Kubernetes cluster. These scripts have been tested for the following pipelines:
You need Docker to build and push Docker images, and [nvidia-docker](https://github.com/NVIDIA/nvidia-docker)to test GPU-enabled Docker images on a local machine. To interact with a Kubernetes cluster, you need [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/).
11
+
To get started, all you need is [nextflow](https://nextflow.io/), [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/), and access to a Kubernetes cluster (in the form of `~/.kube/config`). If you want to test Docker images on your local machine, you will also need [docker](https://docker.com/) and [nvidia-docker](https://github.com/NVIDIA/nvidia-docker) (for GPU-enabled Docker images).
12
12
13
-
## Usage
13
+
## Configuration
14
14
15
-
### Creating a Docker image
15
+
There are a few administrative tasks which must be done in order for nextflow to be able to run properly on the Kubernetes cluster. These tasks only need to be done once, but they may require administrative access to the cluster, so you may need your system administrator to handle this part for you.
16
16
17
-
Build a Docker image:
17
+
- Nextflow needs a service account with the `edit` and `view` cluster roles:
- Nextflow needs access to shared storage in the form of a [Persistent Volume Claim](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) (PVC) with `ReadWriteMany` access mode. The process for provisioning a PVC depends on what types of storage is available. The `kube-create-pvc.sh` script provides an example of creating a PVC for CephFS storage, but it may not apply to your particular cluster. Consult your system administrator for assistance if necessary.
24
+
25
+
## Usage
26
+
27
+
First you must transfer your input data from your local machine to the cluster. You can use the `kube-load.sh` script to do this:
23
28
```bash
24
-
sudo docker run [--runtime=nvidia] --rm -it <tag><command>
29
+
./kube-load.sh <pvc-name><input-dir>
25
30
```
26
31
27
-
List the Docker images on your machine:
32
+
Then you can run the pipeline using nextflow's `kuberun` command:
28
33
```bash
29
-
sudo docker images
34
+
nextflow kuberun <pipeline>
30
35
```
31
36
32
-
Push a Docker image to DockerHub:
37
+
__NOTE__: If you create your own `nextflow.config` in your current directory then nextflow will use that config file instead of the default.
38
+
39
+
Once the pipeline finishes successfully, you can transfer your output data from the cluster using `kube-save.sh`:
33
40
```bash
34
-
sudo docker push <tag>
41
+
./kube-save.sh <pvc-name><output-dir>
35
42
```
36
43
37
-
NOTE: In order to push an image to DockerHub, the image must be tagged with both a username and a repo name. For example:
44
+
You can also use nextflow to create an interactive terminal on the cluster where you can access your PVC directly:
38
45
```bash
39
-
sudo docker tag a88adcfb02de systemsgenetics/gemmaker:latest
40
-
sudo docker push systemsgenetics/gemmaker:latest
46
+
nextflow kuberun login
41
47
```
42
48
43
-
### Running a Job on a Kubernetes cluster
49
+
Consult the [Nextflow Kubernetes documentation](https://www.nextflow.io/docs/latest/kubernetes.html) for more information.
44
50
45
-
Once you install `kubectl`, you must save a configuration to `~/.kube/config`. For example, if you are using [Nautilus](https://nautilus.optiputer.net/) you can download the config file from the Nautilus dashboard by selecting "Get config". Note that authentication tokens for the NRP expire so you will need to download a new config file periodically.
51
+
## Appendix
46
52
47
-
Test your Kubernetes configuration:
53
+
### Working with Docker images
54
+
55
+
__NOTE__: Generally speaking, Docker requires admin privileges in order to run. On Linux, for example, you may need to run Docker commands with `sudo`.
56
+
57
+
Build a Docker image:
48
58
```bash
49
-
kubectl config view
59
+
docker build -t <tag><build-directory>
50
60
```
51
61
52
-
Before you run a job, create a directory with the following:
53
-
- A script named `command.sh` that you want to run on each container
54
-
- Any input data files that are to be copied to each container
55
-
56
-
The script `kube-run.sh` can automatically run a Docker image by (1) creating a job configuration, (2) creating the job, (3) copying input files to each container in the job, (4) executing the command script on each container, and (5) copying output files from each container. You must provide the following:
57
-
- the job name
58
-
- the image you want to run
59
-
- the number of work items
60
-
- the path to your input directory
61
-
- the path to your output directory
62
+
Run a Docker container:
63
+
```bash
64
+
docker run [--runtime=nvidia] --rm -it <tag><command>
0 commit comments