Support

Configuring RStudio Server Pro with Launcher and Kubernetes

Follow
Launcher is a new feature of RStudio Server Pro 1.2 that is only available under named user licensing. RStudio Server Pro 1.2 without Launcher is available under existing server-based licensing. For questions about using Launcher with RStudio Server Pro, please contact sales@rstudio.com.

Overview

These steps represent a minimal configuration of RStudio Server Pro with Launcher and Kubernetes.

Prerequisites

  • RStudio Server Pro 1.2 or higher
  • NFS server that is configured with RStudio Server Pro for home directory project storage
  • Kubernetes cluster
    • Kubernetes API endpoint
    • Kubernetes cluster CA certificate
    • Access to kubectl to create namespaces, service accounts, cluster roles, and role bindings
  • Access to Docker image registry (if working within an offline environment)

Step 1) Configure RStudio Server Pro with Launcher

Add the following lines to the RStudio Server Pro configuration file (default /etc/rstudio/rserver.conf):

# Launcher Config
launcher-address=127.0.0.1
launcher-port=5559
launcher-sessions-enabled=1
launcher-default-cluster=Kubernetes
launcher-sessions-callback-address=https://<RSP-IP-ADDRESS>:8787
launcher-sessions-container-run-as-root=0
launcher-sessions-create-container-user=1
admin-enabled=1
admin-group=rstudio-server,rstudio
admin-superuser-group=rstudio-server,rstudio

Replace <RSP-IP-ADDRESS> with the IP address of RStudio Server Pro. You should also change the protocol from https and port from the default port (8787) as needed.

 

Step 2) Configure Launcher settings and plugins

Add the following lines to the Launcher configuration file (default /etc/rstudio/launcher.conf):

[server]
address=127.0.0.1
port=5559
server-user=rstudio-server
admin-group=rstudio-server
authorization-enabled=1
thread-pool-size=4
enable-debug-logging=1

[cluster]
name=Local
type=Local
exe=/usr/lib/rstudio-server/bin/rstudio-local-launcher
allowed-groups=rstudio

[cluster]
name=Kubernetes
type=Kubernetes
exe=/usr/lib/rstudio-server/bin/rstudio-kubernetes-launcher

 

3) Configure profile for Launcher Kubernetes plugin

Add the following lines to the Launcher profiles configuration file (default /etc/rstudio/launcher.kubernetes.profiles.conf):

[*]
default-cpus=1
default-mem-mb=512
max-cpus=2
max-mem-mb=1024
container-images=rstudio/r-session-complete:centos7-1.2.1335-1-r-3.5.3
default-container-image=rstudio/r-session-complete:centos7-1.2.1335-1-r-3.5.3
allow-unknown-images=0

Replace <DOCKER-IMAGE> with the Docker image to use for R sessions and jobs.

For more information on using Docker images with Launcher, refer to the support article on Using Docker images with RStudio Server Pro, Launcher, and Kubernetes.

 

Step 4) Configure NFS mounts for Launcher

Add the following lines to the Launcher mounts configuration file (default /etc/rstudio/launcher-mounts):

# Home directory mount for RSP, Launcher, and Kubernetes
Host: <NFS-IP-ADDRESS>
Path: /home/{USER}
MountPath: /home/{USER}
ReadOnly: false
Cluster: Kubernetes

Replace <NFS-IP-ADDRESS> with the IP address of your NFS server.

 

Step 5) Create Kubernetes resources for Launcher sessions and jobs

Run the following commands in a shell to create the rstudio namespace and required service account, cluster role, and role bindings:

kubectl create namespace rstudio
kubectl create serviceaccount job-launcher --namespace rstudio
kubectl create clusterrole job-launcher-api \
--verb=impersonate \
--resource=users,groups,serviceaccounts
kubectl create rolebinding job-launcher-impersonation \
--clusterrole=job-launcher-api \
--group=system:serviceaccounts:rstudio \
--namespace=rstudio
kubectl create rolebinding job-launcher-admin \
--clusterrole=cluster-admin \
--group=system:serviceaccounts:rstudio \
--namespace=rstudio

 

Step 6) Configure Launcher with Kubernetes

Obtain the Kubernetes token for the service account in the rstudio namespace by running the following command in your shell:

kubectl get secret $(kubectl get serviceaccount job-launcher --namespace=rstudio -o jsonpath='{.secrets[0].name}') --namespace=rstudio -o jsonpath='{.data.token}' | base64 -d

Add the following lines to the Launcher Kubernetes configuration file (default /etc/rstudio/launcher.kubernetes.conf):

api-url=<KUBERNETES-API-ENDPOINT>
auth-token=<KUBERNETES-CLUSTER-TOKEN>

where <KUBERNETES-API-ENDPOINT> is the URL for the Kubernetes API, and <KUBERNETES-CLUSTER-TOKEN> is the Kubernetes service account token from the previous step in this section.

Add the Kubernetes CA certificate for your cluster to /usr/share/pki/ca-trust-source/anchors/cert-eks-cluster.crt.

Run the following commands in a shell to add the Kubernetes CA certificate

sudo update-ca-trust

 

Step 7) Restart RStudio Server Pro and Launcher Services

sudo rstudio-server restart
sudo rstudio-launcher restart

 

Step 8) Test RStudio Server Pro with Launcher and Kubernetes

Run the following command to test the installation and configuration of RStudio Server Pro with Launcher and Kubernetes:

sudo rstudio-server stop
sudo rstudio-server verify-installation --verify-user=<USER>
sudo rstudio-server start

Replace <USER> with a valid username of a user that is setup to run RStudio Server Pro in your installation.

Refer to the Troubleshooting section in the RStudio Server Pro Administration Guide for more information on using the Launcher verification tool.

 

Troubleshooting RStudio Server Pro and Launcher

Refer to the support article on Troubleshooting Launcher in RStudio Server Pro for additional information on troubleshooting RStudio Server Pro with Launcher and Kubernetes.

 

Reference Documentation for RStudio Server Pro and Launcher

For more information on configuring RStudio Server Pro and Launcher, refer to the following reference documentation:

Comments