-
Notifications
You must be signed in to change notification settings - Fork 0
How to install DirectPV in local OpenShift
Cesar Celis Hernandez edited this page Oct 2, 2023
·
3 revisions
To document how DirectPV can be installed in local OpenShift and its current issues.
-
Get CRC Running with OpenShift.
-
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
- 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
-
Reduced replicas to 1 for single node scenario.
-
Check on the info:
$ kubectl directpv info
┌──────────────────────┬──────────┬───────────┬─────────┬────────┐
│ NODE │ CAPACITY │ ALLOCATED │ VOLUMES │ DRIVES │
├──────────────────────┼──────────┼───────────┼─────────┼────────┤
│ • crc-87z92-master-0 │ - │ - │ - │ - │
└──────────────────────┴──────────┴───────────┴─────────┴────────┘
- Discover Drives:
$ kubectl directpv discover
Discovered node 'crc-87z92-master-0' ✔
No drives are available to initialize
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#
- To address above issue I started a discussion in crc repo to see if adding more disks is possible: https://github.com/orgs/crc-org/discussions/3854
- Use virsh command to attach a disk: https://www.cyberciti.biz/faq/how-to-add-disk-image-to-kvm-virtual-machine-with-virsh-command/
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
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.