RStudio on Kubernetes
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
About
A few years ago I had an external drive that got damaged. I was able to repair it and I found many materials I thought were lost forever.
Amongst nice Shiny apps, I found some codes to run RStudio on Kubernetes. After some minimal changes, I was able to transform that into a one click application you can deploy on Kubernetes clusters.
1-Click install
Go to marketplace.digitalocean.com and search for “RStudio Kubernetes” to then select “Install App”.
Change the cluster region (i.e. to AMS or FRA) or any option you find it’s convenient, then proceed to install RStudio on a new or existing cluster. I installed on a new cluster for testing.
For a new cluster, select the number of nodes and then put the cluster under any project.
Getting started
The total setup time takes around 4 minutes. I’ve decided to automatically install patches and not to add additional applications.
The setup can be done from DigitalOcean site except for one step that involves pasting into the command line.
Once the top of the dashboard doesn’t show a progress bar anymore, the installation is ready. It shows a “Kubernetes Dashboard” button when it’s ready.
Specific instructions
The specific instructions for RStudio consist in three steps.
First: List the pods on Kubernetes
~ $ kubectl get pods -A NAMESPACE NAME READY STATUS RESTARTS AGE ... rstudio rstudio-12345-67890 1/1 Running 0 9m
Second: Forward port 8787 to access RStudio
~ $ kubectl -n rstudio port-forward deploy/rstudio 8787 Forwarding from 127.0.0.1:8787 -> 8787 Forwarding from [::1]:8787 -> 8787
Third: Log in to RStudio by visiting localhost:8787
from the browser. This
Kubernetes instance uses rstudio for both user and password, to change that
type passwd
rstudio in RStudio’s terminal.
Start running scripts
The next script took around 10 seconds including installing RPostgres package.
Get free DigitalOcean credits
If you register with this link, you’ll get free credits to try DigitalOcean and I also get credits for my FOSS projects:
My DigitalOcean Referral Link https://m.do.co/c/6119f0430dad
Shameless self-promotion: If you liked this post, I am an Applied Statistician with years of experience in R, Shiny, APIs, SQL and finance. If you think I can be a valuable addition for your team, I’m happy to read from you and provide more details. My email is mavargas 11 [ at ] uc dot cl or send me a tweet to pachadotdev.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.