Discover local disks

LocalVolumeDiscovery inventories unused block devices on cluster nodes and writes one LocalVolumeDiscoveryResult object per node. Use the result to choose device paths for a LocalVolume or filters for a LocalVolumeSet.

Discovery does not create PersistentVolumes, StorageClasses, or filesystems. A device with status.state: Available is free for provisioning. It is not a PersistentVolume.

Prerequisites

  • Alauda Container Platform Local Disk Provisioner is installed. See Install.
  • You can run kubectl against the cluster.

Check whether discovery already exists

After Alauda Container Platform Local Disk Provisioner is installed, the platform creates a LocalVolumeDiscovery named auto-discover-devices in acp-storage when Alauda Container Platform Storage Essentials is also installed and no LocalVolumeDiscovery exists yet.

On a control plane node:

kubectl -n acp-storage get localvolumediscovery

If auto-discover-devices is listed, do not create another object. Inspect the results in the next section. To limit which nodes are scanned, edit spec.nodeSelector on that object.

Create a LocalVolumeDiscovery

Create a LocalVolumeDiscovery only when none exists in acp-storage.

cat << EOF | kubectl apply -f -
apiVersion: local.storage.openshift.io/v1alpha1
kind: LocalVolumeDiscovery
metadata:
  name: auto-discover-devices
  namespace: acp-storage
spec:
  nodeSelector:
    nodeSelectorTerms:
      - matchExpressions:
          - key: kubernetes.io/hostname
            operator: In
            values:
              - worker-01
              - worker-02
              - worker-03
  tolerations:
    - operator: Exists
EOF
  1. Optional. Nodes that run discovery. Get hostnames from kubectl get node. If omitted, discovery runs on every node.
  2. Optional. Tolerations passed to the discovery DaemonSet. operator: Exists matches every taint.

Inspect discovery results

On a control plane node:

kubectl -n acp-storage get localvolumediscoveryresult

Example output:

NAME                         AGE
discovery-result-worker-01   21m
discovery-result-worker-02   21m
discovery-result-worker-03   21m

Each selected node gets a LocalVolumeDiscoveryResult. Inspect devices on one node:

kubectl -n acp-storage get localvolumediscoveryresult discovery-result-worker-01 -o yaml

Use status.discoveredDevices[].deviceID (a /dev/disk/by-id/... path) as the stable path in a LocalVolume. Do not use path values such as /dev/sdb or /dev/disk/by-path/.... Those names can change after a node reboot.

status.discoveredDevices[].status.state is one of:

StateMeaning
AvailableThe device is unused and can be provisioned. No PersistentVolume exists yet.
NotAvailableThe device is already in use and must not be provisioned.
UnknownThe operator cannot determine whether the device is free.

Devices in the list are non-removable, not read-only, not mounted, not boot disks, and have no child partitions. Discovery still does not create volumes.

Next steps