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 one way 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.

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 kubernetes.io/no-provisioner 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 -
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: rsc-external-storage
provisioner: kubernetes.io/no-provisioner
EOF

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.

Note

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

RSC_NFS_SERVER=<your-external-storage-endpoint>

# this must match the root of your Connect data directory on
# external storage
RSC_NFS_EXPORT_PATH=<your-external-storage-export-path>

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

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

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:

sharedStorage:
  # 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

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

config:
  Launcher:
    # 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.