Skip to content

Latest commit

 

History

History
86 lines (57 loc) · 2.37 KB

volume_creation_deletion_cli.rst

File metadata and controls

86 lines (57 loc) · 2.37 KB

Volume Management using the CLI

To use persistent storage in a MetalK8s cluster, one needs to create Volume objects. In order to create Volumes you need to have StorageClass objects registered in your cluster. See /operation/volume_management/storageclass_creation

Volume Creation

This section describes how to create a Volume from the CLI.

  1. Create a Volume manifest

    You can define a new Volume using the following template:

    apiVersion: storage.metalk8s.scality.com/v1alpha1
    kind: Volume
    metadata:
      name: <volume_name>
    spec:
      nodeName: <node_name>
      storageClassName: <storageclass_name>
      mode: "Filesystem"
      rawBlockDevice:
        devicePath: <device_path>

    Set the following fields:

    • name: the name of your volume, must be unique
    • nodeName: the name of the node where the volume will be located.
    • storageClassName: the StorageClass to use
    • mode: describes how the volume is intended to be consumed, either Block or Filesystem (default to Filesystem if not specified).
    • devicePath: path to the block device (for example, /dev/sda1).
  2. Create the Volume

    root@bootstrap $ kubectl apply -f volume.yml
  3. Verify that the Volume was created

    root@bootstrap $ kubectl get volume <volume_name>
    NAME             NODE        STORAGECLASS
    <volume_name>   bootstrap   metalk8s-demo-storageclass

Volume Deletion

This section highlights how to delete a Volume in a MetalK8s cluster using the CLI

  1. Delete a Volume

    root@bootstrap $ kubectl delete volume <volume_name>
    volume.storage.metalk8s.scality.com <volume_name> deleted
  2. Check that the Volume has been deleted

    Note

    The command below returns a list of all volumes. The deleted volume entry should not be found in the list.

    root@bootstrap $ kubectl get volume