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
  • Docker image registry (if working within an offline environment)

RStudio Server Pro Configuration for 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=<RSP-IP-ADDRESS>
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.

 

Launcher Configuration

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

 

Launcher Kubernetes Profiles Configuration

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=<DOCKER-IMAGE>
default-container-image=<DOCKER-IMAGE>
allow-unknown-images=0

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

 

Launcher NFS Mount Configuration

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.

 

Create RStudio Namespace in Kubernetes

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

 

Launcher Kubernetes API Configuration

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.

 

Configure Kubernetes Cluster

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

 

Restart RStudio Server Pro and Launcher Services

sudo rstudio-server restart
sudo rstudio-launcher restart

 

Troubleshooting 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 RStudio Server Pro documentation on Troubleshooting for additional information on the Launcher verification tool.

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

Comments