Using External Storage

If you prefer to utilize an external storage instance for Posit Connect’s data directory, such as Amazon EFS or Azure file shares, the following sections describe two possible ways to accomplish this. Please ensure that your Kubernetes cluster is configured according to your cloud provider’s instructions. For example, your Kubernetes cluster might need to have Container Storage Interface (CSI) drivers and virtual networks configured.

Option 1: Using a PersistentVolumeClaim

Step 1: Create a no-op StorageClass

This StorageClass is specified in our Helm chart’s values. The Helm chart uses this StorageClass when it creates a PersistentVolumeClaim to be used as Connect’s data directory. The provisioner, notifies Kubernetes that no action is necessary to provision a PersistentVolume because we create one manually in the next step.

cat <<EOF | kubectl apply -f -
kind: StorageClass
  name: rsc-external-storage

Step 2: Create a PersistentVolume

In this step we create a PersistentVolume that meets the criteria of the PersistentVolumeClaim that will later be created by the Helm chart.


Verify the location of your Posit Connect data directory on the external storage instance, and ensure that it matches the spec.nfs.path value in your PersistentVolume spec.

# modify these values to match your environment


# this must match the root of your Connect data directory on
# external storage

# you may modify this value to change the amount of storage that is
# available to Posit Connect

# create a PV, backed by your external share
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolume
  name: rsc-pv
  storageClassName: rsc-external-storage
    storage: ${RSC_STORAGE_VOLUME}
  volumeMode: Filesystem
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
    path: ${RSC_NFS_EXPORT_PATH}
    server: ${RSC_NFS_SERVER}

Step 3: Modify the Helm Chart Values

Now we need to tell the Helm chart about the storage class to use when creating the PersistentVolumeClaim for Connect’s data directory. Note that the storageClassName specified below, matches the no-op StorageClass that we created in step 1.

To do this, modify the following values in your values.yaml:

  # Tell the chart to create a PVC for connect's data dir
  create: true

  # Tell the chart to mount this PVC to the connect Pod
  mount: true

  # The name of the PVC that will be 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.
  storageClassName: rsc-external-storage

    # This should match value used for RSC_STORAGE_VOLUME in the
    # previous step.
    storage: 100G

    # Tell the job-launcher to use Connect's data dir PVC when
    # launching content jobs
    DataDirPVCName: rsc-pvc

Step 4: Apply the Changes to your Installation

See the kubernetes deployment section to see how to create your installation, or apply these changes to an existing installation.

Option 2: Using a “raw” NFS volume

Posit Connect can also be configured to use an existing NFS server export with a raw NFS volume. This eliminates the need to create a PersistentVolumeClaim as we did in Option 1 above.

Step 1: Modify the Helm Chart Values

In this step, we configure the Connect Pod to mount the NFS export at /var/lib/rstudio-connect. We also configure the persistent storage location for content Pods that are launched by Posit Connect.

    - name: connect-data
        server: <your-external-storage-endpoint>
        path: <your-external-storage-export-path>
        readOnly: false
    - mountPath: /var/lib/rstudio-connect
      name: connect-data

    DataDir: /var/lib/rstudio-connect

    DataDirNFSHost: <your-external-storage-endpoint>
    DataDir: <your-external-storage-export-path>

Step 2: Apply the Changes to your Installation

See the kubernetes deployment section to see how to create your installation, or apply these changes to an existing installation.