Updated on 2024-09-30 GMT+08:00

Configuring OBS Mount Options

This section describes how to configure OBS volume mount options. You can configure mount options in a PV and bind the PV to a PVC. Alternatively, configure mount options in a StorageClass and use the StorageClass to create a PVC. In this way, PVs can be dynamically created and inherit mount options configured in the StorageClass by default.

OBS Mount Options

When mounting an OBS volume, the Everest add-on presets the options described in Table 1 and Table 2 by default. The options in Table 1 are mandatory. You can set other mount options if needed. For details, see Mounting a Parallel File System.

Table 1 Mandatory mount options configured by default

Parameter

Value

Description

use_ino

Leave it blank.

If enabled, obsfs allocates the inode number. Enabled by default in read/write mode.

big_writes

Leave it blank.

If configured, the maximum size of the cache can be modified.

nonempty

Leave it blank.

Allows non-empty mount paths.

allow_other

Leave it blank.

Allows other users to access the parallel file system.

no_check_certificate

Leave it blank.

Disables server certificate verification.

sigv2

Leave it blank.

Specifies the signature version. Used by default in object buckets.

public_bucket

1

If this parameter is set to 1, public buckets are mounted anonymously. Enabled by default in object bucket read-only mode.

Table 2 Optional mount options configured by default

Parameter

Value

Description

max_write

131072

This parameter is valid only when big_writes is configured. The recommended value is 128 KB.

ssl_verify_hostname

0

Disables SSL certificate verification based on the host name.

max_background

100

Allows setting the maximum number of waiting requests in the background. Used by default in parallel file systems.

umask

0

Mask of the configuration file permission.

For example, if the umask value is 022, the directory permission (the maximum permission is 777) is 755 (777 – 022 = 755, rwxr-xr-x).

Configuring Mount Options in a PV

You can use the mountOptions field to configure mount options in a PV. The options you can configure in mountOptions are listed in OBS Mount Options.

  1. Use kubectl to connect to the cluster. For details, see Connecting to a Cluster Using kubectl.
  2. Configure mount options in a PV. Example:

    apiVersion: v1
    kind: PersistentVolume
    metadata:
      annotations:
        pv.kubernetes.io/provisioned-by: everest-csi-provisioner
        everest.io/reclaim-policy: retain-volume-only      # (Optional) The PV is deleted while the underlying volume is retained.
      name: pv-obs       # PV name.
    spec:
      accessModes:
      - ReadWriteMany    # Access mode. The value must be ReadWriteMany for OBS.
      capacity:
        storage: 1Gi     # OBS volume capacity.
      csi:
        driver: obs.csi.everest.io        # Dependent storage driver for the mounting.
        fsType: obsfs                     # Instance type.
        volumeHandle: <your_volume_id>    # Name of the OBS volume.
        volumeAttributes:
          storage.kubernetes.io/csiProvisionerIdentity: everest-csi-provisioner
          everest.io/obs-volume-type: STANDARD
          everest.io/region: <your_region>                        # Region where the OBS volume is located.
          everest.io/enterprise-project-id: <your_project_id>     # (Optional) Enterprise project ID. If an enterprise project is specified, use the same enterprise project when creating a PVC. Otherwise, the PVC cannot be bound to a PV.
    
        nodePublishSecretRef:            # Custom secret of the OBS volume.
          name: <your_secret_name>       # Custom secret name.
          namespace: <your_namespace>    # Namespace of the custom secret.
      persistentVolumeReclaimPolicy: Retain    # Reclaim policy.
      storageClassName: csi-obs               # Storage class name.
      mountOptions:                            # Mount options.
      - umask=027

  3. After a PV is created, you can create a PVC and bind it to the PV, and then mount the PV to the container in the workload. For details, see Using an Existing OBS Bucket Through a Static PV.

Configuring Mount Options in a StorageClass

You can use the mountOptions field to configure mount options in a StorageClass. The options you can configure in mountOptions are listed in OBS Mount Options.

  1. Use kubectl to connect to the cluster. For details, see Connecting to a Cluster Using kubectl.
  2. Create a customized StorageClass. Example:

    kind: StorageClass
    apiVersion: storage.k8s.io/v1
    metadata:
      name: csi-obs-mount-option
    provisioner: everest-csi-provisioner
    parameters:
      csi.storage.k8s.io/csi-driver-name: obs.csi.everest.io
      csi.storage.k8s.io/fstype: s3fs
      everest.io/obs-volume-type: STANDARD
    reclaimPolicy: Delete
    volumeBindingMode: Immediate
    mountOptions:                            # Mount options.
    - umask=027

  3. After the StorageClass is configured, you can use it to create a PVC. By default, the dynamically created PVs inherit the mount options configured in the StorageClass. For details, see Using an Existing OBS Bucket Through a Static PV.