I'm trying to figure out how to launch a web application in a Kubernetes cluster on AWS. Right now I'm not certain about a database. I can see that one can use raw block volumes, which are supposedly faster:

This mode is useful to provide a Pod the fastest possible way to access a volume, without any filesystem layer between the Pod and the volume.


And they seem to be recommended particularly for databases:

There are some specialized applications that require direct access to a block device because, for example, the file system layer introduces unneeded overhead. The most common case is databases, which prefer to organize their data directly on the underlying storage.


By databases they supposedly mean PostgreSQL, MariaDB, Redis, whatever.

As such, I wonder if I should use raw block volumes for databases. Because on one hand they recommend it, but I didn't see an example. If so, should I create a custom database image to mount the device into the directory? Interestingly, Kubegres doesn't seem to be using block volumes:


My test yaml file:

apiVersion: apps/v1
kind: Deployment
  name: mydeployment
  namespace: myns
  replicas: 1
      app: myapp
        app: myapp
      - name: app
        image: mariadb
          value: '1'
        - name: persistent-storage
          devicePath: /dev/xvda
      - name: persistent-storage
          claimName: ebs-claim
apiVersion: v1
kind: PersistentVolumeClaim
  name: ebs-claim
  namespace: myns
  - ReadWriteOnce
  storageClassName: gp2
  volumeMode: Block
      storage: 1Gi
  • Are you using some Managed Kubernetes Service like EKS? And are you just trying to attach a Disk/SSD as a PVC ? Can you show where is the info where "they recommend it"? Oct 16 '21 at 13:59
  • 1
    @KristianKanchev Indeed, I was probably too succinct. See the updated question. I'm using EKS. That's probably the best option on AWS. And I've managed to attach a EBS volume to the container as you can probably see. Not sure if that can be called a disk/SSD. They question is about make a database use the device. And if it's worth it.
    – x-yuri
    Oct 17 '21 at 7:19
  • Yes, EBS is an SSD as per this document. It's good that you are using EKS, for example, we use MongoDB which uses a PVC from a snapshot, so it is totally worth it depending on what you need. I suggest you use the CSI driver for managing your PVC and EBS CSI driver doc. Oct 17 '21 at 11:57
  • So for the other question, I suggest you see how to deploy a WordPress app on EKS as it will use the similar setup you are going for with the PVC, then redo it for your app. Example HowTo Oct 17 '21 at 12:05
  • @KristianKanchev Thanks for the example. I've got to inspect it more closely. But at first glance, it doesn't use raw block volumes :) When I said "worth it," I meant them (raw block volumes). Should I consider that as, "You don't normally need them, particularly with PostgreSQL, MariaDB, ..."? Any advantages of the CSI driver you can name off the top of your head?
    – x-yuri
    Oct 19 '21 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.