How to install DirectPV in local OpenShift - cniackz/public GitHub Wiki

Objective:

To document how DirectPV can be installed in local OpenShift and its current issues.

Steps:

  1. Get CRC Running with OpenShift.

  2. Install OpenShift:

$ kubectl directpv install

 ███████████████████████████████████████████████████████████████████████████ 100%

┌──────────────────────────────────────┬──────────────────────────┐
│ NAME                                 │ KIND                     │
├──────────────────────────────────────┼──────────────────────────┤
│ directpv                             │ Namespace                │
│ directpv-min-io                      │ ServiceAccount           │
│ directpv-min-io                      │ ClusterRole              │
│ directpv-min-io                      │ ClusterRoleBinding       │
│ directpv-min-io                      │ Role                     │
│ directpv-min-io                      │ RoleBinding              │
│ directpvdrives.directpv.min.io       │ CustomResourceDefinition │
│ directpvvolumes.directpv.min.io      │ CustomResourceDefinition │
│ directpvnodes.directpv.min.io        │ CustomResourceDefinition │
│ directpvinitrequests.directpv.min.io │ CustomResourceDefinition │
│ directpv-min-io                      │ CSIDriver                │
│ directpv-min-io                      │ StorageClass             │
│ node-server                          │ Daemonset                │
│ controller                           │ Deployment               │
└──────────────────────────────────────┴──────────────────────────┘

DirectPV installed successfully

  1. Give permissions to the accounts:
oc adm policy add-scc-to-user privileged -n directpv -z builder
oc adm policy add-scc-to-user privileged -n directpv -z default
oc adm policy add-scc-to-user privileged -n directpv -z deployer
oc adm policy add-scc-to-user privileged -n directpv -z directpv-min-io
  1. Reduced replicas to 1 for single node scenario.

  2. Check on the info:

$ kubectl directpv info
┌──────────────────────┬──────────┬───────────┬─────────┬────────┐
│ NODE                 │ CAPACITY │ ALLOCATED │ VOLUMES │ DRIVES │
├──────────────────────┼──────────┼───────────┼─────────┼────────┤
│ • crc-87z92-master-0 │ -        │ -         │ -       │ -      │
└──────────────────────┴──────────┴───────────┴─────────┴────────┘
  1. Discover Drives:
$ kubectl directpv discover

 Discovered node 'crc-87z92-master-0' ✔

No drives are available to initialize

Current problem the VM has only one used disk:

sh-4.4# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0    7:0    0   16M  0 loop 
vda    252:0    0   31G  0 disk 
|-vda1 252:1    0    1M  0 part 
|-vda2 252:2    0  127M  0 part 
|-vda3 252:3    0  384M  0 part /host/boot
`-vda4 252:4    0 30.5G  0 part /host/sysroot
sh-4.4# 

ubuntu:

cd /var/lib/libvirt/images
virsh attach-disk crc /var/lib/libvirt/images/ubuntu-box1-vm-disk1-5G vdb --cache none
ccelis@asus:/var/lib/libvirt/images$ virsh attach-disk crc       /var/lib/libvirt/images/ubuntu-box1-vm-disk1-5G vdb --cache none
Disk attached successfully

sh-4.4# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vda    252:0    0   31G  0 disk 
|-vda1 252:1    0    1M  0 part 
|-vda2 252:2    0  127M  0 part 
|-vda3 252:3    0  384M  0 part /host/boot
`-vda4 252:4    0 30.5G  0 part /host/sysroot
vdb    252:16   0    5G  0 disk 
ccelis@asus:~$ kubectl directpv discover

 Discovered node 'crc-lz7xw-master-0' ✔

┌─────────────────────┬────────────────────┬───────┬─────────┬────────────┬──────┬───────────┬─────────────┐
│ ID                  │ NODE               │ DRIVE │ SIZE    │ FILESYSTEM │ MAKE │ AVAILABLE │ DESCRIPTION │
├─────────────────────┼────────────────────┼───────┼─────────┼────────────┼──────┼───────────┼─────────────┤
│ 252:16$Uve+S8J8A... │ crc-lz7xw-master-0 │ vdb   │ 5.0 GiB │ -          │ -    │ YES       │ -           │
└─────────────────────┴────────────────────┴───────┴─────────┴────────────┴──────┴───────────┴─────────────┘

Generated 'drives.yaml' successfully.

ccelis@asus:~$ kubectl directpv init drives.yaml --dangerous

 ███████████████████████████████████████████████████████████████████████████ 100%

 Processed initialization request 'd0b32a9d-c7c7-4ae1-9167-24f3baff8ce0' for node 'crc-lz7xw-master-0' ✔

┌──────────────────────────────────────┬────────────────────┬───────┬─────────┐
│ REQUEST_ID                           │ NODE               │ DRIVE │ MESSAGE │
├──────────────────────────────────────┼────────────────────┼───────┼─────────┤
│ d0b32a9d-c7c7-4ae1-9167-24f3baff8ce0 │ crc-lz7xw-master-0 │ vdb   │ Success │
└──────────────────────────────────────┴────────────────────┴───────┴─────────┘

ccelis@asus:~$ kubectl directpv info
┌──────────────────────┬──────────┬───────────┬─────────┬────────┐
│ NODE                 │ CAPACITY │ ALLOCATED │ VOLUMES │ DRIVES │
├──────────────────────┼──────────┼───────────┼─────────┼────────┤
│ • crc-lz7xw-master-0 │ 5.0 GiB  │ 0 B       │ 0       │ 1      │
└──────────────────────┴──────────┴───────────┴─────────┴────────┘

0 B/5.0 GiB used, 0 volumes, 1 drives

Conclusion:

For now we are going to use Ubuntu OS to get this working as it is where we can attach a disk to the VM.