You have a Kubernetes workload that does aggressive small-block random IO — a search index, an event store, a transactional database — and you have benchmarked your current CSI storage layer and concluded it is the bottleneck. The application is hitting iowait cliff-faces during steady-state writes, your p99 latencies are not where you need them, and the storage system underneath is doing every write through a userspace network protocol with a non-trivial copy chain. NVMe drives are sitting in the nodes with two-digit microsecond service times locally, and any storage layer that adds milliseconds on top is leaving most of the SSD performance on the floor. OpenEBS Mayastor is built for this case — it uses SPDK and NVMe-over-Fabrics (TCP or RDMA) to keep the data path off the kernel, pins replicated pools to specific NVMe devices, and gives you a CSI driver that is meaningfully closer to bare-metal NVMe latency than anything that runs through the regular kernel block stack.
What’s happening
OpenEBS Mayastor is a high-performance storage engine that runs as a DaemonSet on each storage node, owns a set of raw NVMe block devices (no filesystem, no LVM, no partitions Mayastor doesn’t manage), and exposes them as one or more DiskPool resources. Volumes are placed as one or more replicas across pools, and the data path between the application node and the storage replicas is NVMe-oF — by default, NVMe over TCP, which works on any 10G+ network without specialized hardware. The Mayastor I/O engine is a SPDK process that runs on hugepages with dedicated CPU cores; that is non-negotiable, because SPDK pre-allocates memory and pins poll threads to avoid context switches.
The pieces are: the DiskPool (a raw NVMe device claimed by Mayastor on a specific node, formatted with the SPDK blob store on top), the Volume (a Mayastor CRD with a replica count and a pool selector — replicas land on different nodes), the StorageClass (which the workload references; it sets replica count, NVMe transport, FS type, and any topology constraints), and the agent-core controller (the brain that places replicas, watches for failed nodes, and rebuilds when capacity allows). When something goes wrong, it is almost always: hugepages not allocated, NVMe device not actually claimable (already partitioned, in use by another driver, multipathd claimed it), or the SPDK process can’t get enough CPU because the node is co-scheduling something noisy.
How to verify
Storage class is real and is the default for Mayastor-backed volumes:
kubectl get sc
# NAME PROVISIONER RECLAIMPOLICY ... IsDefault
# mayastor-3 (default) io.openebs.csi-mayastor true
Mayastor I/O engine pods are healthy on every storage node and the DiskPools are Online:
kubectl -n openebs get pods -l app=io-engine -o wide
# io-engine-xxxxx 2/2 Running k3s-01
# io-engine-xxxxx 2/2 Running k3s-02
# io-engine-xxxxx 2/2 Running k3s-03
kubectl get diskpool -n openebs -o wide
# NAME NODE STATE POOL_STATUS CAPACITY USED AVAILABLE
# pool-k3s-01 k3s-01 Created Online 892999274496 0 892999274496
# pool-k3s-02 k3s-02 Created Online 892999274496 0 892999274496
# pool-k3s-03 k3s-03 Created Online 892999274496 0 892999274496
Any pool in Faulted is not serving IO — find out why before you ship workloads:
kubectl -n openebs get diskpool pool-k3s-01 -o yaml | grep -A5 status
Hugepages are actually allocated on the storage nodes — if this returns 0, no IO will happen:
grep HugePages_Total /proc/meminfo
# HugePages_Total: 1024 (with 2M pages = 2 GiB)
# or, with 1Gi hugepages, HugePages_Total: 2 / Hugepagesize: 1048576 kB = 2 GiB
A pod with a replicated Mayastor volume, end-to-end:
kubectl run mayastor-smoke --rm -it --image=busybox:1.36 --restart=Never \
--overrides='{"spec":{"containers":[{"name":"mayastor-smoke","image":"busybox:1.36","command":["sh","-c","dd if=/dev/zero of=/data/x bs=4k count=200000 oflag=direct && sync && ls -lh /data"],"volumeMounts":[{"mountPath":"/data","name":"d"}]}],"volumes":[{"name":"d","persistentVolumeClaim":{"claimName":"mayastor-smoke-pvc"}}]}}' 2>/dev/null || true
The fix
Save the script as /root/setup-mayastor.sh and run the BASE PREP block on every node, then the K3S SERVER + MAYASTOR block on the first node only. Assume /dev/nvme1n1 is a dedicated NVMe drive on each node — wiped and untouched by anything else (no partitions, no LVM, no multipathd).
#!/usr/bin/env bash
set -euo pipefail
### AlmaLinux 9 + k3s + OpenEBS Mayastor installer with NVMe-oF
### BASE PREP on every node; K3S SERVER + MAYASTOR block on the first node only
### /dev/nvme1n1 must be a dedicated, unpartitioned NVMe device on each node
if [[ "$(id -u)" -ne 0 ]]; then
echo "Run as root."
exit 1
fi
# === EDIT PER DEPLOYMENT ===
NODE_ROLE="server" # server on the first node; agent on the others
NODE_NAME="k3s-01" # k3s-01 / k3s-02 / k3s-03
K3S_SERVER_IP="10.40.0.11"
K3S_TOKEN="CHANGE_ME_K3S_TOKEN"
MAYASTOR_VERSION="2.7.3"
MAYASTOR_NVME_DEVICE="/dev/nvme1n1"
HUGEPAGES_2M=2048 # 2048 * 2 MiB = 4 GiB hugepages per node
DEFAULT_REPLICA_COUNT=3
# ===========================
echo
echo "========================================"
echo "BASE PREP — Mayastor node ${NODE_NAME}"
echo "========================================"
echo
echo "==> Updating base OS"
dnf -y update
dnf -y install epel-release
dnf -y install vim curl wget chrony fail2ban dnf-automatic \
policycoreutils-python-utils lsof tcpdump bind-utils tar gzip \
iproute net-tools jq socat parted util-linux nvme-cli pciutils \
iscsi-initiator-utils device-mapper-multipath
systemctl enable --now chronyd
echo "==> SELinux permissive (Mayastor + k3s CSI socket interactions are noisy in enforcing)"
sed -i 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config
setenforce 0 || true
echo "==> Disabling firewalld (k3s pulls iptables rules; firewalld will fight)"
systemctl disable --now firewalld 2>/dev/null || true
echo "==> Hugepages for SPDK"
cat > /etc/sysctl.d/99-mayastor.conf <<SYSCTL
vm.nr_hugepages = ${HUGEPAGES_2M}
SYSCTL
sysctl --system
# Persist across reboot via grub if requested
echo "==> Verifying hugepage allocation"
grep HugePages_Total /proc/meminfo
echo "==> Kernel modules required by NVMe-oF transport"
cat > /etc/modules-load.d/mayastor.conf <<'MODS'
nvme_tcp
nvme_fabrics
nbd
MODS
modprobe nvme_tcp || true
modprobe nvme_fabrics || true
modprobe nbd || true
echo "==> multipathd blacklist for Mayastor NVMe devices"
mkdir -p /etc/multipath/conf.d
cat > /etc/multipath/conf.d/blacklist-mayastor.conf <<'MPATH'
blacklist {
devnode "^nvme[0-9]+n[0-9]+"
}
MPATH
if systemctl is-active multipathd >/dev/null 2>&1; then
systemctl restart multipathd
fi
echo "==> Validating dedicated NVMe device ${MAYASTOR_NVME_DEVICE}"
if [[ ! -b "${MAYASTOR_NVME_DEVICE}" ]]; then
echo "ERROR: ${MAYASTOR_NVME_DEVICE} is not present"
exit 1
fi
if blkid "${MAYASTOR_NVME_DEVICE}" >/dev/null 2>&1; then
echo "WARN: ${MAYASTOR_NVME_DEVICE} has existing signatures — wiping"
wipefs -a "${MAYASTOR_NVME_DEVICE}"
fi
if lsblk -nro NAME,MOUNTPOINT "${MAYASTOR_NVME_DEVICE}" | awk '$2!=""{exit 1}'; then
echo "OK: ${MAYASTOR_NVME_DEVICE} not mounted"
else
echo "ERROR: ${MAYASTOR_NVME_DEVICE} has mounted partitions — abort"
exit 1
fi
echo "==> Sysctl — Mayastor IO engine kernel knobs"
cat > /etc/sysctl.d/99-mayastor-tcp.conf <<'SYSCTL'
net.core.rmem_max = 33554432
net.core.wmem_max = 33554432
net.core.rmem_default = 524288
net.core.wmem_default = 524288
net.ipv4.tcp_rmem = 4096 87380 33554432
net.ipv4.tcp_wmem = 4096 65536 33554432
net.core.netdev_max_backlog = 60000
net.core.somaxconn = 8192
fs.inotify.max_user_watches = 1048576
fs.inotify.max_user_instances = 8192
SYSCTL
sysctl --system
if [[ "${NODE_ROLE}" == "agent" ]]; then
echo
echo "==> Installing k3s agent against ${K3S_SERVER_IP}"
curl -sfL https://get.k3s.io | \
K3S_URL="https://${K3S_SERVER_IP}:6443" \
K3S_TOKEN="${K3S_TOKEN}" \
INSTALL_K3S_EXEC="agent --node-name=${NODE_NAME}" \
sh -
echo "==> Labeling node for Mayastor scheduling — do this from the server side after agent registers:"
echo " kubectl label node ${NODE_NAME} openebs.io/engine=mayastor"
echo " kubectl label node ${NODE_NAME} openebs.io/csi-node=true"
exit 0
fi
echo
echo "========================================"
echo "K3S SERVER + MAYASTOR"
echo "========================================"
echo
echo "==> Installing k3s server"
curl -sfL https://get.k3s.io | \
INSTALL_K3S_EXEC="server --disable=traefik --node-name=${NODE_NAME} --node-ip=${K3S_SERVER_IP} --advertise-address=${K3S_SERVER_IP} --token=${K3S_TOKEN} --write-kubeconfig-mode=600 --cluster-init" \
sh -
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
mkdir -p /root/.kube
cp /etc/rancher/k3s/k3s.yaml /root/.kube/config
echo "==> Waiting for the k3s server to register"
for i in {1..60}; do
if kubectl get nodes >/dev/null 2>&1; then break; fi
sleep 2
done
echo
echo "==> K3S NODE TOKEN (use as K3S_TOKEN on agents):"
cat /var/lib/rancher/k3s/server/node-token
echo
echo "==> Labeling the server node for Mayastor"
kubectl label node "${NODE_NAME}" openebs.io/engine=mayastor --overwrite
kubectl label node "${NODE_NAME}" openebs.io/csi-node=true --overwrite
echo "==> Installing Helm"
curl -fsSL https://baltocdn.com/helm/signing.asc | gpg --dearmor -o /usr/share/keyrings/helm.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" \
> /etc/yum.repos.d/helm-stable.list || true
# Use the rpm path on AlmaLinux
dnf -y install https://get.helm.sh/helm-v3.15.4-linux-amd64.tar.gz 2>/dev/null || true
if ! command -v helm >/dev/null 2>&1; then
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
fi
echo "==> Helm repo: openebs"
helm repo add openebs https://openebs.github.io/openebs
helm repo update
echo "==> Installing OpenEBS Mayastor"
kubectl create namespace openebs --dry-run=client -o yaml | kubectl apply -f -
cat > /root/openebs-values.yaml <<EOF
engines:
local:
lvm:
enabled: false
zfs:
enabled: false
replicated:
mayastor:
enabled: true
mayastor:
csi:
node:
initContainers:
enabled: true
io_engine:
target:
nvmf:
iface: ""
ports:
- "8420"
cpuCount: 2
coreList:
- 1
- 2
hugePagesAlloc: "${HUGEPAGES_2M}"
agents:
core:
logLevel: info
EOF
helm upgrade --install openebs openebs/openebs \
--namespace openebs \
--version "${MAYASTOR_VERSION}" \
-f /root/openebs-values.yaml
echo "==> Waiting for Mayastor IO engines to come up"
kubectl -n openebs rollout status daemonset/openebs-io-engine --timeout=300s
echo "==> Creating DiskPool on this node: ${MAYASTOR_NVME_DEVICE}"
cat <<EOF | kubectl apply -f -
apiVersion: "openebs.io/v1beta2"
kind: DiskPool
metadata:
name: pool-${NODE_NAME}
namespace: openebs
spec:
node: ${NODE_NAME}
disks: ["${MAYASTOR_NVME_DEVICE}"]
EOF
echo "==> Creating a replicated StorageClass (3 replicas, NVMe over TCP)"
cat <<EOF | kubectl apply -f -
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: mayastor-${DEFAULT_REPLICA_COUNT}
annotations:
storageclass.kubernetes.io/is-default-class: "true"
provisioner: io.openebs.csi-mayastor
allowVolumeExpansion: true
volumeBindingMode: Immediate
parameters:
ioTimeout: "60"
protocol: nvmf
repl: "${DEFAULT_REPLICA_COUNT}"
fsType: xfs
thin: "false"
stsAffinityGroup: "true"
reclaimPolicy: Delete
EOF
echo
echo "==> Provisioning a 4Gi PVC + smoke writer pod"
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mayastor-smoke-pvc
namespace: default
spec:
accessModes: [ReadWriteOnce]
storageClassName: mayastor-${DEFAULT_REPLICA_COUNT}
resources:
requests:
storage: 4Gi
---
apiVersion: v1
kind: Pod
metadata:
name: mayastor-smoke
namespace: default
spec:
restartPolicy: Never
containers:
- name: w
image: busybox:1.36
command: ["sh","-c","dd if=/dev/zero of=/data/test bs=4k count=200000 oflag=direct && sync && ls -lh /data && sleep 5"]
volumeMounts:
- { name: data, mountPath: /data }
volumes:
- name: data
persistentVolumeClaim:
claimName: mayastor-smoke-pvc
EOF
echo "==> Wait for smoke pod and pull logs"
kubectl wait --for=condition=Ready pod/mayastor-smoke -n default --timeout=180s || true
sleep 8
kubectl logs mayastor-smoke -n default || true
echo
echo "========================================"
echo "DONE — server node"
echo "========================================"
echo
echo "Verify pools (after every agent has registered and been labeled):"
echo " kubectl get diskpool -n openebs -o wide"
echo
echo "Verify the Mayastor CSI driver registered:"
echo " kubectl get csidrivers"
echo
echo "Next on each AGENT node:"
echo " - Set NODE_ROLE=agent, NODE_NAME=k3s-XX, K3S_TOKEN=<node-token printed above>"
echo " - Run /root/setup-mayastor.sh"
echo " - From the server: kubectl label node k3s-XX openebs.io/engine=mayastor openebs.io/csi-node=true --overwrite"
echo " - From the server: create DiskPool for that node referencing its /dev/nvme1n1"
echo
After every node has joined and been labeled, the only thing left is to materialize the DiskPool for each agent. From the server:
for n in k3s-02 k3s-03; do
kubectl label node "$n" openebs.io/engine=mayastor openebs.io/csi-node=true --overwrite
cat <<EOF | kubectl apply -f -
apiVersion: "openebs.io/v1beta2"
kind: DiskPool
metadata:
name: pool-${n}
namespace: openebs
spec:
node: ${n}
disks: ["/dev/nvme1n1"]
EOF
done
kubectl get diskpool -n openebs -o wide
Operational notes that bite people on the second week:
- Hugepages must persist across reboot. The script writes
vm.nr_hugepagesto/etc/sysctl.d/99-mayastor.conf. If you skip that step and a node reboots, the IO engine pod CrashLoopBackOffs withFailed to allocate hugepagesand the node leaves the pool. For 1 GiB hugepages, configure them viadefault_hugepagesz=1G hugepagesz=1G hugepages=4on the kernel command line. - Mayastor does not share NVMe devices. Pass it a raw device. Not a partition, not an LV, not a device with an old
mdadmsuperblock. The script wipes signatures, but if the device is in use bymultipathd,nbd, or another driver, Mayastor will refuse to open it and the DiskPool will sit inPending. - NVMe-oF target ports are pod-internal. The script binds the target on
8420/tcpinside the IO engine pod’s network. Cross-node replica IO uses the pod network — make sure your overlay (flannel, calico, cilium) is not throttling the SDN, because storage will inherit any latency the overlay adds. - Don’t run
numactl --interleaveon the IO engine. SPDK pins threads to specific cores. Interleaving memory across NUMA nodes degrades performance and confuses the SPDK scheduler. If you have NUMA, allocate hugepages and pin cores on a single node and let the IO engine see a uniform memory layout. - Replica count is durability, not performance. Three replicas tolerate one node loss with zero data loss and one-replica degraded operation. Performance is bounded by the slowest replica’s commit, not the median — a noisy NVMe will drag latency for every write.
Stack Harbor runs Mayastor-backed k3s and full k8s clusters under Managed Cloud Ops on managed cloud compute — hugepages persisted at install, multipathd correctly blacklisted, IO-engine logs streamed into our observability plane — start a scoping call if you want NVMe-class CSI without owning the operator runbooks.