Production Rook-Ceph on Kubernetes: Deploying Cloud-Native Distributed Block, File, and Object Storage

DevOps tutorial - IT technology blog
DevOps tutorial - IT technology blog

The Problem: Managing Stateful Workloads Beyond Cloud Vendor Lock-In

Stateful workloads on Kubernetes get tricky once you move beyond dev-cluster persistent volumes. Cloud-managed CSI plugins like AWS gp3 or GCP pd-ssd work well initially. Soon, though, operational pain sets in.

Moving an EBS-backed pod across Availability Zones can take several minutes due to volume detachment lag. Provisioning 10,000 IOPS per volume quietly inflates monthly cloud bills by hundreds of dollars. On bare metal, the story is no better: teams end up wrestling with legacy NFS arrays or rigid SAN hardware that cannot dynamically scale when nodes join or leave.

Most production environments inevitably demand three storage patterns under one roof:

  • Block Storage (RWO): High-throughput, sub-millisecond volumes dedicated to databases like PostgreSQL 16, MySQL, or Redis.
  • Shared File Systems (RWX): POSIX-compliant file trees shared across dozens of pods for WordPress uploads, shared runtime caches, or machine learning datasets.
  • Object Storage (S3 API): HTTP-accessible buckets for database backups, Prometheus long-term metrics, and microservice uploads.

Stitching together separate third-party appliances for each tier burns engineering hours and fractures monitoring. Running software-defined storage directly inside Kubernetes eliminates that sprawl.

Core Concepts: Rook as the Kubernetes Operator for Ceph

Ceph is a proven, distributed open-source storage cluster. It runs on commodity hardware with zero single point of failure. It handles CRUSH map distribution, self-healing, striping, and data scrub checks automatically. Running it by hand, however, has historically been painful. Administrators had to manually provision cluster daemons, configure systemd units, partition raw disks, and balance placement groups.

Rook automates this entire operational lifecycle. As a graduated CNCF project, Rook packages Ceph management into Kubernetes Custom Resource Definitions (CRDs) and controllers.

How Rook-Ceph Components Interact

Rook maps Ceph cluster roles directly to Kubernetes primitives:

  • Ceph Monitors (MONs): Store the cluster map and manage Paxos consensus. Keep an odd quorum in production—typically 3 or 5 instances spread across different failure domains.
  • Ceph Managers (MGRs): Collect runtime metrics, coordinate placement group autoscaling, and host the web dashboard.
  • Object Storage Daemons (OSDs): Run directly on storage nodes. Each OSD manages one physical NVMe or SATA SSD, handling read, write, and replication operations.
  • Ceph CSI Drivers: Provision block and filesystem PVCs dynamically when workloads ask for them.
  • Metadata Servers (MDS) & Rados Gateway (RGW): Daemon layers providing POSIX file semantics (CephFS) and S3-compatible REST endpoints.

Once Rook is configured, storage engineers manage petabytes of distributed capacity through standard kubectl workflows.

Hands-on Practice: Deploying Rook-Ceph on a Multi-Node Cluster

You will need a Kubernetes cluster (v1.26+) with at least three worker nodes. Each storage node requires a dedicated, unformatted disk (such as /dev/sdb or /dev/nvme1n1) without partitions or filesystems.

Step 1: Prerequisites and Node Disk Preparation

Inspect attached storage devices on each designated worker node:

# Check disks and existing filesystem signatures
lsblk -f

# Zap any lingering partition tables or LVM metadata
sudo wipefs -a /dev/sdb
sudo dd if=/dev/zero of=/dev/sdb bs=1M count=100 oflag=direct,dsync

Step 2: Install the Rook Operator

Fetch release v1.13.5 and apply the required Custom Resource Definitions and RBAC roles:

git clone --single-branch --branch v1.13.5 https://github.com/rook/rook.git
cd rook/deploy/examples

# Deploy CRDs, namespaces, and the operator deployment
kubectl create -f crds.yaml -f common.yaml -f operator.yaml

# Verify the operator enters the Running state
kubectl -n rook-ceph get pod -l app=rook-ceph-operator

Step 3: Deploy the Production Ceph Cluster

The CephCluster manifest dictates daemon placement, networking mode, and disk discovery. The configuration below pins OSDs to specific raw drives across three storage nodes:

# cluster-prod.yaml
apiVersion: ceph.rook.io/v1
kind: CephCluster
metadata:
  name: rook-ceph
  namespace: rook-ceph
spec:
  cephVersion:
    image: quay.io/ceph/ceph:v18.2.2
    allowUnsupported: false
  dataDirHostPath: /var/lib/rook
  mon:
    count: 3
    allowMultiplePerNode: false
  mgr:
    count: 2
    allowMultiplePerNode: false
    modules:
      - name: pg_autoscaler
        enabled: true
  dashboard:
    enabled: true
    ssl: true
  network:
    provider: host
  crashCollector:
    disable: false
  storage:
    useAllNodes: false
    useAllDevices: false
    nodes:
      - name: "worker-node-01"
        devices:
          - name: "sdb"
      - name: "worker-node-02"
        devices:
          - name: "sdb"
      - name: "worker-node-03"
        devices:
          - name: "sdb"
  healthCheck:
    daemonHealth:
      mon:
        disabled: false
        interval: 45s
      osd:
        disabled: false
        interval: 60s

Apply the manifest and track cluster bootstrapping:

kubectl apply -f cluster-prod.yaml

# Watch daemons spin up across the nodes
kubectl -n rook-ceph get pods -w

Step 4: Configure Storage Engine 1 — Block Storage (RWO)

Block storage delivers sequential and random I/O throughput for databases. Define a 3x replicated pool and create a corresponding Kubernetes StorageClass:

# rbd-storageclass.yaml
apiVersion: ceph.rook.io/v1
kind: CephBlockPool
metadata:
  name: builtin-replicated-pool
  namespace: rook-ceph
spec:
  failureDomain: host
  replicated:
    size: 3
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: rook-ceph-block
provisioner: rook-ceph.rbd.csi.ceph.com
parameters:
  clusterID: rook-ceph
  pool: builtin-replicated-pool
  imageFormat: "2"
  imageFeatures: layering
  csi.storage.k8s.io/provisioner-secret-name: rook-csi-rbd-provisioner
  csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph
  csi.storage.k8s.io/controller-expand-secret-name: rook-csi-rbd-provisioner
  csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph
  csi.storage.k8s.io/node-stage-secret-name: rook-csi-rbd-node
  csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph
  csi.storage.k8s.io/fstype: ext4
reclaimPolicy: Delete
allowVolumeExpansion: true

Test dynamic volume creation with a 20Gi claim:

# test-block-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: db-block-claim
spec:
  storageClassName: rook-ceph-block
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
kubectl apply -f rbd-storageclass.yaml
kubectl apply -f test-block-pvc.yaml
kubectl get pvc db-block-claim

Step 5: Configure Storage Engine 2 — Shared File System (RWX)

CephFS allows multiple pods across different nodes to mount the same filesystem simultaneously. Spin up two active Metadata Server daemons for redundancy:

# cephfs.yaml
apiVersion: ceph.rook.io/v1
kind: CephFilesystem
metadata:
  name: shared-fs
  namespace: rook-ceph
spec:
  metadataPool:
    replicated:
      size: 3
  dataPools:
    - failureDomain: host
      replicated:
        size: 3
      name: data0
  metadataServer:
    activeCount: 1
    activeStandby: true
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: rook-cephfs
provisioner: rook-ceph.cephfs.csi.ceph.com
parameters:
  clusterID: rook-ceph
  fsName: shared-fs
  pool: shared-fs-data0
  csi.storage.k8s.io/provisioner-secret-name: rook-csi-cephfs-provisioner
  csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph
  csi.storage.k8s.io/node-stage-secret-name: rook-csi-cephfs-node
  csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph
reclaimPolicy: Delete
allowVolumeExpansion: true

Applications can now declare claims with accessModes: [ReadWriteMany] backed by rook-cephfs.

Step 6: Configure Storage Engine 3 — S3-Compatible Object Store

Internal object storage keeps backup and asset traffic off third-party APIs. Deploy Rados Gateway (RGW) to expose an in-cluster S3 endpoint:

# object-store.yaml
apiVersion: ceph.rook.io/v1
kind: CephObjectStore
metadata:
  name: local-s3
  namespace: rook-ceph
spec:
  metadataPool:
    failureDomain: host
    replicated:
      size: 3
  dataPool:
    failureDomain: host
    replicated:
      size: 3
  gateway:
    port: 80
    instances: 2
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: rook-ceph-bucket
provisioner: rook-ceph.ceph.rook.io/bucket
reclaimPolicy: Delete
parameters:
  objectStoreName: local-s3
  objectStoreNamespace: rook-ceph

Workloads request buckets via ObjectBucketClaim (OBC). Rook generates a ConfigMap and a Secret containing the endpoint URL, Access Key, and Secret Key automatically.

Step 7: Verification and Toolbox Diagnostics

Check health status and data placement using the official Rook toolbox:

kubectl apply -f toolbox.yaml
kubectl -n rook-ceph exec -it deploy/rook-ceph-tools -- bash

# Run internal Ceph commands inside the toolbox:
ceph status
ceph osd tree
ceph df

Look for HEALTH_OK in the status line. Confirm all OSDs report up and in, and check that placement groups show active+clean.

Production Hardening and Operational Considerations

Running Ceph inside Kubernetes demands strict hardware and network boundaries:

  • Separate Network Planes: Replication traffic spikes rapidly during disk rebuilds. Separate public client traffic from private OSD replication using Multus CNI over dual 10Gbps or 25Gbps NICs. Otherwise, data syncs can saturate pod networks.
  • Resource Guarantees: OSDs consume memory heavily during recovery. Reserve at least 2 CPU cores and 4GB to 8GB of RAM per OSD pod. Setting low memory limits risks Linux kernel OOM kills right when the disk is rebuilding.
  • Failure Domains: Set failureDomain: host for single-rack setups, or failureDomain: zone across availability zones. Never run production clusters with a replication factor below 3.

Rook-Ceph turns commodity NVMe drives into a resilient storage fabric. You gain cloud-native agility without cloud provider egress bills or proprietary storage vendor lock-in.

Share: