Before anyone asks why you'd want to do that, I'm using molecule to test my "infrastructure as code" locally before deploying it to actual machines.
Start by creating two block devices:
# dd if=/dev/zero of=/tmp/test0 bs=1M count=10
# dd if=/dev/zero of=/tmp/test1 bs=1M count=10
# losetup /dev/loop0 /tmp/test0
# losetup /dev/loop1 /tmp/test1
Now create the array:
# mdadm --create /dev/md127 --metadata=0.90 --level=1 --raid-devices=2 /dev/loop0 /dev/loop1
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.76-linuxkit/modules.dep.bin'
modprobe: FATAL: Module md_mod not found in directory /lib/modules/4.19.76-linuxkit
mdadm: Fail create md127 when using /sys/module/md_mod/parameters/new_array
mdadm: unexpected failure opening /dev/md127
I tried installing the linux-generic
package to populate the missing /lib/modules
directory, but it doesn't look like the correct version of that package exists for the running kernel (this is on Ubuntu 20.04):
# uname -r
4.19.76-linuxkit
# apt show linux-generic | grep Version
Version: 5.4.0.12.15