This site is archived

Posit Connect support for off-host content execution has entered General Availability (GA).
Documentation about off-host execution is now included in the Connect Admin Guide.
The instructions presented here were associated with the off-host execution beta and are now obsolete.

Configuration and Deployment

Using Kubernetes to host Posit Connect service and content execution

Configure your Helm Chart values

Posit maintains a Helm chart for deploying Posit Connect on Kubernetes. The Helm chart is the recommended method for running Posit Connect in a Kubernetes environment. The Posit Connect Helm chart is highly configurable and supports multiple deployment options to meet your organization’s requirements.

The values.yaml file will be used to override defaults specified within the Helm chart. The steps below will help you set the values for the initial deployment. Post validation, this file will then need to be updated with your ongoing deployment values.

If you’re an experienced Helm user and would like to see some concrete examples of what these deployments would look like in a production environment, check out the sample values files.

Step 1: Create your initial values.yaml file

Create a file called values.yaml for your Posit Connect installation with the following contents.

# Controls how many instances of Posit Connect will be created.
replicas: 1

# Configures shared storage for the Posit Connect pod.
sharedStorage:
  create: true
  mount: true

  # The name of the PVC that will be created for Connect's data directory.
  # This PVC is also specified by `Launcher.DataDirPVCName` below.
  name: rsc-pvc

  # The storageClass to use for Connect's data directory. Must support RWX.
  storageClassName: rsc-nfs
  requests:
    storage: 100G

# Enables building and executing content in isolated Kubernetes pods.
launcher:
  enabled: true

# The config section overwrites values in Posit Connect's main .gcfg configuration file.
config:

  # Configures the Postgres connection for Posit Connect.
  Database:
    Provider: "Postgres"
  Postgres:
    URL: "postgres://connect@rsc-db-postgresql.rstudio-connect.svc.cluster.local:5432/rsc_k8s?sslmode=disable"
    # While it is possible to set a Postgres password here in the values file, we recommend providing
    #   the password at runtime using helm install's --set argument instead
    #   (e.g. --set config.Postgres.Password=<your-postgres-database-password>)

  Launcher:
    # Configures the job launcher to use Connect's data dir PVC when launching content jobs
    # This has the same value as `sharedStorage.name` above
    DataDirPVCName: rsc-pvc

Step 2: Replace the sample values

Your environment may require some changes to be made to the initial values pasted into the values.yaml file. For example if you are providing your own PostgreSQL database or are using an alternate storage provider than the NFS instance used in this guide, make sure to update those values as needed.

Note

If you would like to view the chart’s entire set of default values, use the command:

helm show values rstudio/rstudio-connect
Warning

Even if you plan to eventually implement a Highly Available (HA) topology, we strongly recommend that the initial deployment configuration utilize a single node. We’ll provide instructions post-deployment to update this value to the number of desired HA instances.

Step 3: Migrating your existing Posit Connect configuration

Note

If your Posit Connect installation is new, you can skip to the next step.

As you’ve seen in the previous section, configuration values for the Posit Connect Server are provisioned within the values.yaml file when executing within Kubernetes (provisioned by Helm Charts). You’ll need to move your existing settings from your rstudio-connect.gcfg file into the values.yaml file to maintain your settings within the new server. See Helm Chart Reference for further information.

Step 4: Adjust your Package Manager URL

Note

If your Posit Connect installation is new, you can skip to the next step.

Note

When migrating existing content to a new Connect installation, the packrat cache can sometimes become out of sync when using binary packages. Temporarily switching to a source package repository can help avoid some common errors resulting from binary packages.

If using Posit Package Manager, make sure that the URL you are using references the source packages (rather than the binary package link). The Posit Connect Admin Guide has additional details about configuring R Package Repositories

For example, the following values.yaml entries uses source packages from Posit Package Manager for bionic images:

config:
  'RPackageRepository "CRAN"':
    URL: https://packagemanager.rstudio.com/cran/latest

This will result in the following entries within the rstudio-connect.gcfg file to be generated:

[RPackageRepository "CRAN"]
URL = https://packagemanager.rstudio.com/cran/latest

Step 5: Add temporary settings

There are a few settings which should be temporarily merged into the values.yaml file to allow the migration cache rebuilding process to occur in an orderly fashion. Be sure to record what you originally had these values at (if you had them specified at all), so that you can return them back to their original values at the end of the upgrade.

Scheduler.MinProcessesLimit

config:
  Scheduler:
    MinProcessesLimit: 0

Setting this value to zero will keep Posit Connect from spinning up processes before the migration is complete. The Posit Connect Admin Guide has additional details about Scheduler.MinProcessesLimit.

Applications.ScheduleConcurrency

config:
  Applications:
    ScheduleConcurrency: 0

Setting this value to zero will keep Posit Connect from starting scheduled jobs before the migration is complete. The Posit Connect Admin Guide has additional details about Applications.ScheduleConcurrency.

Applications.PythonEnvironmentReaping

config:
  Applications:
    PythonEnvironmentReaping: false

Setting this value to false will keep Posit Connect from reaping unused Python environments until your migration is complete. The Posit Connect Admin Guide has additional details about Applications.PythonEnvironmentReaping

Tip

Congratulations! If you have completed all of the preceding steps, you should be ready to deploy!