A newer version of this documentation is available.

View Latest

Configure Persistent Volumes

      +
      How to use persistent volumes with a Couchbase cluster.

      Storage Class Configuration

      Ensure you have read the storage classes documentation and created any necessary storage classes for your platform.

      Couchbase Cluster Configuration

      Once storage classes are provisioned correctly using them is simple:

      apiVersion: couchbase.com/v2
      kind: CouchbaseCluster
      spec:
        servers:
        - size: 1
          name: data_services
          services:
            - data
          volumeMounts:
            default: couchbase (1)
        volumeClaimTemplates: (2)
        - metadata:
            name: couchbase (3)
          spec:
            storageClassName: standard (4)
            resources: (5)
              requests:
                storage: 1Gi
      1 spec.servers[].volumeMounts.default tells the Operator to provision a default persistent volume claim and attach it to a pod of that server class.
      2 spec.volumeClaimTemplates[] defines a list of templates related to storage. These will be used to create Kubernetes persistent volume claims and therefore have the same data structure. However the Operator is only concerned with the following parameters, any others are ignored.
      3 spec.volumeClaimTemplates[].metadata.name is a unique identifier for a persistent volume template. It is referred to by attributes in the spec.servers[].volumeMounts object.
      4 spec.volumeClaimTemplates[].spec.storageClassName refers to a dynamically allocated storage class defined on the platform.
      5 spec.volumeClaimTemplates[].spec.resources defines the size of the volume that will be allocated.