Skip to main content
Mount file storage
Last update:

Mount file storage

File storage can be mounted:

Mount file storage to a dedicated or cloud server

The mount process depends on the operating system on the server and the file storage protocol: NFSv4 or CIFS SMBv3.

  1. Connect to the cloud server.

  2. Open the CLI.

  3. Install the NFS protocol package:

    sudo apt install nfs-common
  4. Create a folder to mount the repository:

    sudo mkdir -p /mnt/nfs
  5. Mount the file storage:

    sudo mount -vt nfs "<filestorage_ip_address>:/shares/share-<mountpoint_uuid>" /mnt/nfs

    Specify:

    • <filestorage_ip_address> — The IP address of the file storage. You can look in control panels under Cloud platformFile storage → storage page → tab Settings → field IP;
    • <mountpoint_uuid> — The ID of the mount point. You can look in control panels under Cloud platformFile storage → storage page → block Connection → tab GNU/Linux.

Mount file storage to a Managed Kubernetes cluster

The mount process depends on the file storage protocol: NFSv4 or CIFS SMBv3.

  1. Create PersistentVolume.
  2. Create PersistentVolumeClaim.
  3. Add file storage to the container.

Create PersistentVolume

  1. Connect to a Managed Kubernetes cluster.

  2. Create a yaml file with a manifest for the PersistentVolume object:

    apiVersion: v1
    kind: PersistentVolume
    metadata:
    name: pv_name
    spec:
    storageClassName: storageclass_name
    capacity:
    storage: <storage_size>
    accessModes:
    - ReadWriteMany
    nfs:
    path: /shares/share-<mountpoint_uuid>
    server: <filestorage_ip_address>

    Specify:

    • <storage_size> — PersistentVolume size in GB (file storage size), e.g. 100 Gi. The limit is from 50 GB to 50 TB;
    • <mountpoint_uuid> — The ID of the mount point. You can look in control panels under Cloud platformFile storage → storage page → block Connection → tab GNU/Linux;
    • <filestorage_ip_address> — The IP address of the file storage. You can look in control panels under Cloud platformFile storage → storage page → tab Settings → field IP.
  3. Apply the manifest:

    kubectl apply -f <persistent_volume.yaml>

    Specify <persistent_volume.yaml> — the name of the yaml file with the manifest to create the PersistentVolume.

  4. Make sure that a PersistentVolume object is created:

    kubectl get pv

Create a PersistentVolumeClaim

  1. Create a yaml file with a manifest for the PersistentVolumeClaim object:

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
    name: pvc_name
    spec:
    storageClassName: storageclass_name
    accessModes:
    - ReadWriteMany
    resources:
    requests:
    storage: <storage_size>

    Specify <storage_size> — PersistentVolume size in GB (file storage size), e.g. 100 Gi. The limit is from 50 GB to 50 TB.

  2. Apply the manifest:

    kubectl apply -f <persistent_volume_claim.yaml>

    Specify <persistent_volume_claim.yaml> — the name of the yaml file with the manifest to create the PersistentVolumeClaim.

  3. Ensure that a PersistentVolumeClaim object is created:

    kubectl get pvc

Add storage to a container

  1. Create a yaml file with a manifest for the Deployment object:

    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: filestorage_deployment_name
    labels:
    project: filestorage_deployment_name
    spec:
    replicas: 2
    selector:
    matchLabels:
    project: filestorage_project_name
    template:
    metadata:
    labels:
    project: filestorage_project_name
    spec:
    volumes:
    - name: volume_name
    persistentVolumeClaim:
    claimName: pvc_name
    containers:
    - name: container-nginx
    image: nginx:stable-alpine
    ports:
    - containerPort: 80
    name: "http-server"
    volumeMounts:
    - name: volume_name
    mountPath: <mount_path>

    Specify <mount_path> — path to the folder inside the container to which the file storage will be mounted.

  2. Apply the manifest:

    kubectl apply -f <deployment.yaml>

    Specify <deployment.yaml> — the name of the yaml file with the manifest to create the Deployment.