Customizing the Entrypoint with RStudio Server Pro, Job Launcher, and Kubernetes


When RStudio Server Pro is launching R sessions on Kubernetes via the RStudio Job Launcher, customers occasionally need to customize the startup process to do things like start sssd (domain join the container) or provision the execution environment (read group membership from an environment variable, retrieve group memberships, etc.).


It is important to do this properly so that the RStudio Job Launcher can continue to function as designed.


Define the Entrypoint script

First, your session containers need to have a custom entrypoint script. This can be either built into the container or mounted via a configmap. For the purposes of our example, we will use an entrypoint script at /usr/local/bin/

The entrypoint script can contain any arbitrary shell script, provided that it does the following:

  • Does not alter the arguments provided to the script
  • Ends in the following line:
exec "/usr/lib/rstudio-server/bin/rserver-launcher" "$@"


For the purposes of our example, here is our entrypoint script:


echo -e 'The r-session container is starting\n'

# show that this initial process runs as root inside the pod
echo -e 'Starting RStudio Session\n'
exec "/usr/lib/rstudio-server/bin/rserver-launcher" "$@"


Alter the Job to use the Entrypoint Script

In order to get the RStudio Job Launcher to execute this entrypoint script instead of the canonical /usr/lib/rstudio-server/bin/rserver-launcher, we will use the job-json-overrides specification to alter the submitted Kubernetes jobs. This process is articulated more thoroughly in this article.


We will define a job-json-overrides file as follows:



And add the following line to the relevant profiles sections in our launcher.kubernetes.profiles.conf file:




Test that it works

Now restart the rstudio-launcher service and launch a new job. You should see that the job specification is altered to use the new entrypoint script.

$ kubectl get pod session-5ab10cfc78a31fb9c8280-rstudio---rstudio-session-8-sfdgw -o yaml | grep -A 1 command
- /usr/local/bin/

And you can see the effect of the custom entrypoint script in the session logs:

The r-session container is starting 
uid=0(root) gid=0(root) groups=0(root)
Starting RStudio Session



Troubleshooting an improper configuration here is quite tricky since the RStudio Job Launcher does not expose invalid job configuration, but responds with "Kubernetes API failure". 

We intend to improve the product's verbosity in the future so that these types of customization are easier to implement.

Other times, the job config is valid "enough" to launch, but fails immediately. In this case, we recommend looking at the job config with kubectl get pods -o yaml

As with most debugging, start with the simplest configuration you can and slowly iterate to the configuration that you desire, changing one thing at a time.


If you have questions, never hesitate to reach out to