Prerequisites
- Synology NAS running DSM 7.0 or above
- Provisioned Talos cluster running Kubernetes v1.20 or above with
siderolabs/iscsi-toolsextension installed - (Optional) Both Volume Snapshot CRDs and the common snapshot controller must be installed in your Kubernetes cluster if you want to use the Snapshot feature
Setting up the Synology user account
Thesynology-csi controller interacts with your NAS in two different ways: via the API and via the iSCSI protocol.
Actions such as creating a new iSCSI target or deleting an old one are accomplished via the Synology API, and require administrator access.
On the other hand, mounting the disk to a pod and reading from / writing to it will utilize iSCSI.
Because you can only authenticate with one account per DSM configured, that account needs to have admin privileges.
In order to minimize access in the case of these credentials being compromised, you should configure the account with the least possible amount of access – explicitly specify “No Access” on all volumes when configuring the user permissions.
Setting up the Synology CSI
Clone the git repository.deploy/kubernetes/<version>/. These manifests reference the synology/synology-csi image published on Docker Hub, and this guide configures and applies them directly. For additional configuration options and a full reference, see the Synology CSI README.
The manifests you will work with are organized as follows:
Configure connection info
Copy the template to create your connection config file:config/client-info.yml to configure the connection information for DSM.
You can specify one or more storage systems on which the CSI volumes will be created.
See below for an example:
Create the namespace and secret
Create the namespace defined by the manifests, and label it so that the driver’s privileged node pods are admitted under Pod Security Admission: The node DaemonSet runs a privileged container so it can manage iSCSI devices on the host.
Without the privileged enforcement label, Pod Security Admission will emit warnings or block the pods.
Configure the CSI driver
By default, the deployment manifests include one storage class and one volume snapshot class. See below for examples:reclaimPolicy: Retain and the other with reclaimPolicy: Delete.
Alternately, a workload may require a specific filesystem, such as ext4.
If a Synology NAS is going to be the most common way to configure storage on your cluster, it can be convenient to add the storageclass.kubernetes.io/is-default-class: "true" annotation to one of your StorageClasses.
The following table details the configurable parameters for the Synology StorageClass.
The VolumeSnapshotClass can be similarly configured with the following parameters:
Apply YAML manifests
Once you have created the desired StorageClass(es) and VolumeSnapshotClass(es), the final step is to apply the Kubernetes manifests against the cluster. The easiest way to apply them all at once is to create akustomization.yaml file in the same directory as the manifests and use Kustomize to apply: