Configure Your Helm Chart Values

Posit maintains a Helm chart that is required for deploying Posit Connect on Kubernetes. It is highly configurable and supports multiple deployment options to meet your organization’s requirements.

The values.yaml file is 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 then needs to be updated with your ongoing deployment values.

There is a direct mapping between the config section of the values.yaml file and Connect’s rstudio-connect.gcfg configuration file. All values under the config section are converted to GCFG format and placed in the configuration file. See the Posit Connect Service Configuration appendix for details.

If you’re an experienced Helm user and would like to see examples of what these deployments can look like in production, please see the sample values files provided in the Posit Helm repo.

Step 1: Create your initial values.yaml file

Create a file called values.yaml with the following contents:

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

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

  # The name of the PVC created for Connect's data directory.
  # Also specified by `Launcher.DataDirPVCName` below.
  name: rsc-pvc

  # The storageClass to use for Connect's data directory. Must
  # support RWX.
  # Replace with your storage class name if different.
  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:
    # The URL syntax below is to utilize a PostgreSQL database installed
    # in the cluster as described in the Kubernetes Cluster Preparation
    # page of this guide. Change this URL if your PostgreSQL database is
    # setup externally or in a different location.
    URL: "postgres://connect@rsc-db-postgresql.rstudio-connect.svc.cluster.local:5432/connect?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-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

You should modify the initial values.yaml file to match the needs of your environment. 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.

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 provide post-deployment instructions to configure the number of desired HA instances.

Step 3: Migrating your existing Posit Connect configuration

Note

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

As you’ve seen in the previous section, configuration values for the Connect Server are defined in the values.yaml file when executing on Kubernetes and 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 Connect installation is new, you can skip to the next step.

Note

When migrating existing content to a new Connect installation, we recommend using an R package repository that does not serve package binaries. Temporarily switching to a source package repository can help avoid some common errors seen when using package binaries.

If using Posit Package Manager, make sure that the URL you are using references the source packages (rather than the binary package link). The 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:

config:
  'RPackageRepository "CRAN"':
    URL: https://packagemanager.posit.co/cran/latest

This results in the following entries within the Helm-generated rstudio-connect.gcfg file:

[RPackageRepository "CRAN"]
URL = https://packagemanager.posit.co/cran/latest

You can also set the setting R.PositPackageManagerURLRewriting to force-source to force all Posit Package Manager URLs to install source packages, including those from published content. For more information, see Posit Package Manager URL rewriting.

Step 5: Add temporary settings

There are a few settings that 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 their original values (if you had them specified at all), so that you can revert them at the end of the upgrade.

Scheduler.MinProcessesLimit

config:
  Scheduler:
    MinProcessesLimit: 0

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

Applications.ScheduleConcurrency

config:
  Applications:
    ScheduleConcurrency: 0

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

Applications.PythonEnvironmentReaping

config:
  Applications:
    PythonEnvironmentReaping: false

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

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