Rook Client

** rookctl has been deprecated. CRDs are the recommended way to configure the cluster. **

The rookctl client tool can be used to manage your Rook cluster once it is running as well as manage block, file and object storage. See the sections below for details on how to configure each type of storage.

If you don’t yet have a Rook cluster running, refer to our Quickstart Guides.

rookctl can be accessed in the following ways:

  • Kubernetes: Start the toolbox pod

Block Storage

  1. Create a new pool and volume image (10MB)

     rookctl pool create --name rbd --replica-count 1
     rookctl block create --name test --size 10485760
    
  2. Map the block volume and format it and mount it

     # If running in the toolbox container, no need to run privileged
     rookctl block map --name test --format --mount /tmp/rook-volume
    
  3. Write and read a file

     echo "Hello Rook!" > /tmp/rook-volume/hello
     cat /tmp/rook-volume/hello
    
  4. Cleanup

     # If running in the toolbox container, no need to run privileged
     rookctl block unmap --mount /tmp/rook-volume
    

Shared File System

  1. Create a shared file system

     rookctl filesystem create --name testfs --data-replica-count 1 --metadata-replica-count 1
    
  2. Verify the shared file system was created

    rookctl filesystem ls
    
  3. Mount the shared file system from the cluster to your local machine

    # If running in the toolbox container, no need to run privileged
    rookctl filesystem mount --name testfs --path /tmp/rookFS
    
  4. Write and read a file to the shared file system

    echo "Hello Rook!" > /tmp/rookFS/hello
    cat /tmp/rookFS/hello
    
  5. Unmount the shared file system (this does not delete the data from the cluster)

    # If running in the toolbox container, no need to run privileged
    rookctl filesystem unmount --path /tmp/rookFS
    
  6. Cleanup the shared file system from the cluster (this does delete the data from the cluster)

    rookctl filesystem delete --name testfs
    

Object Storage

  1. Create an object storage instance in the cluster

    rookctl object create -n my-store --data-replica-count 1 --metadata-replica-count 1
    
  2. Create an object storage user

    rookctl object user create my-store rook-user "my object store user"
    

Consume the Object Storage

Use an S3 compatible client to create a bucket in the object store. If you are running in Kubernetes, the s3cmd tool is included in the Rook toolbox pod.

  1. Get the connection information for accessing object storage

    eval $(rookctl object connection my-store rook-user --format env-var)
    
  2. Create a bucket in the object store

    s3cmd mb --no-ssl --host=${AWS_HOST} --host-bucket=  s3://rookbucket
    
  3. List buckets in the object store

    rookctl object bucket list my-store
    
  4. Upload a file to the newly created bucket

    echo "Hello Rook!" > /tmp/rookObj
    s3cmd put /tmp/rookObj --no-ssl --host=${AWS_HOST} --host-bucket=  s3://rookbucket
    
  5. Download and verify the file from the bucket

    s3cmd get s3://rookbucket/rookObj /tmp/rookObj-download --no-ssl --host=${AWS_HOST} --host-bucket=
    cat /tmp/rookObj-download