2. Getting started

This tutorial explains how to quick-start with REANA-Cluster.

2.1. Deploy locally

Are you looking at installing and deploying REANA cluster locally on your laptop?

  1. Install kubectl (e.g. version 1.14.0), minikube (e.g. version 1.0.0) and Helm (e.g. version 2.12.3):

    $ sudo dpkg -i kubectl*.deb minikube*.deb kubernetes-helm*.deb
    
  2. Start Minikube virtual machine and then deploy Helm inside the cluster:

    $ minikube start --feature-gates="TTLAfterFinished=true"
    $ helm init
    
  3. Install REANA-Cluster sources. You probably want to use a virtual environment:

    $ # create new virtual environment
    $ virtualenv ~/.virtualenvs/myreana
    $ source ~/.virtualenvs/myreana/bin/activate
    $ # install reana-cluster utility
    $ pip install reana-cluster
    
  4. Start REANA cluster instance on Minikube:

    $ reana-cluster init --traefik
    

Note

--traefik flag triggers installation and initialization of Traefik ingress controller. REANA needs it for interactive session feature to work.

  1. Check the status of the REANA cluster deployment. (Note that it may take several minutes to pull the REANA component images for the first time.)

    $ reana-cluster status
    ...
    REANA cluster is ready.
    
  2. Display the commands to set up the environment for the user clients:

    $ reana-cluster env
    export REANA_SERVER_URL=http://192.168.99.100:32732
    $ eval $(reana-cluster env --include-admin-token)
    

    If you need to create more users you can:

    $ kubectl exec \
          -ti $(kubectl get pods -l=app=server -o jsonpath='{.items[0].metadata.name}') \
          -- flask users create \
                -e jane.doe@example.org \
                --admin-access-token $REANA_ACCESS_TOKEN
    User was successfully created.
    ID                                     EMAIL                  ACCESS_TOKEN
    09259d12-b06c-4a13-a696-ae8e57f1f0c9   jane.doe@example.org   dHYXgh5AXmukZrdWccZaSg
    
  3. You can now run REANA examples on the locally-deployed cluster using reana-client.

    Note that after you finish testing REANA, you can delete the locally-deployed cluster and the Minikube virtual machine as follows:

    $ reana-cluster down
    $ minikube stop
    

2.2. Deploy on CERN infrastructure

  1. Log into lxplus-cloud (CC7 subset of lxplus with recent OpenStack clients) and create a working directory for reana:

    $ ssh lxplus-cloud.cern.ch
    $ mkdir reana && cd reana
    
  2. Setup your OpenStack account and create a Kubernetes cluster following the official documentation.

  3. Load the configuration to connect to the Kubernetes cluster and wait for the pods to be created:

    $ $(openstack coe cluster config reana-cloud)
    $ kubectl get pods -w
    
  4. Set one of the nodes to be an ingress controller and create a landb alias:

    $ kubectl label node <node-name> role=ingress
    $ openstack server set --property landb-alias=<your-subdomain> <ingress-node>
    
  5. Create or add ssl secrets:

    $ openssl req -x509 -nodes -days 365 -newkey rsa:2048
          -keyout /tmp/tls.key -out /tmp/tls.crt
          -subj "/CN=<your-subdomain>.cern.ch"
    $ kubectl create secret tls reana-ssl-secrets
          --key /tmp/tls.key --cert /tmp/tls.crt
    

Note

This is important to set even if HTTPS is not desired, otherwise the Traefik controller will not redirect the traffic.

  1. As we are using the alpha feature gate TTLAfterFinished we need to manually activate it:

    # Get the Kube master name and connect to it
    $ openstack server list | grep -E reana-.*-master
    $ ssh -i <ssh-key> fedora@<master-node>
    # Add to the `--feature-gates` the `TTLAfterFinished=true` flag
    > sudo vi /etc/kubernetes/apiserver
    # Finally restart the API server
    > sudo systemctl restart kube-apiserver
    
  2. Since Python3 does not come by default we have to use the slc command to activate it and we create a virtual environment for REANA:

    $ scl enable rh-python36 bash
    $ virtualenv reana
    $ source reana/bin/activate
    
  3. Install reana-cluster:

    (reana) $ pip install reana-cluster
    
  4. Instantiate REANA cluster using CVMFS and CEPHFS:

    Edit reana_cluster/backends/kubernetes/templates/persistentvolumeclaims/ceph.yaml and set spec.recources.requests.storage to the size you want the CEPHFS shared volume to be. Note that it is possible to set CEPHS volume size via cli by passing --cephfs-volume-size <size in GB>. You can also set cluster URL with option --url <REANA_cluster_URL>.

    (reana) $ reana-cluster -f reana-cluster.yaml --cvmfs --cephfs --url reana.cern.ch init
    
  5. Test that REANA can be accessed by its domain name:

(reana) $ curl http://reana.cern.ch/api/ping
{"message": "OK", "status": "200"}

2.3. Next steps

For more information, please see:

  • Looking for a more comprehensive user manual? See User guide
  • Looking for tips how to develop REANA-Cluster component? See Developer guide
  • Looking for command-line API reference? See CLI API