Juju operator storage

Juju can make use of existing storage classes set up in Kubernetes, but the preferred approach is to model things with Juju via storage pools. For MAAS, or any other substrate, you set the storage-provisioner attribute of the Juju storage pool to be that of the provisioner value you’d use with a Kubernetes storage class. So this storage pool:

juju create-storage-pool k8s-ebs kubernetes storage-class=juju-ebs storage-provisioner=kubernetes.io/aws-ebs parameters.type=gp2

Will result in Juju creating a storage class similar to:

kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
  name: k8s-ebs
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2

If you do want to set up a storage class outside of Juju, Juju can use that too. If you mark a storage pool as the default for the whole cluster, via the _storageclass.kubernetes.io/is_default_class_ annotation, that will be used. You can also use labels to tell Juju to use a particular storage class.

Juju will look for an existing storage class with the following characteristics and pick the first one it finds:

  1. storage class called “juju-operator-storage”
  2. storage class with label “juju-storage”, one of:
    • <app>-operator-storage
    • <model>
    • "default"
  3. storageclass.kubernetes.io/is-default-class

The above is for operator storage. For Juju units themselves, it’s similar.

  1. storage class called “juju-unit-storage”
  2. storage class with label “juju-storage”, one of:
    • <app>-unit-storage
    • <model>
    • "default"
  3. storageclass.kubernetes.io/is-default-class

Some general Juju storage doc is here. But it’s being migrated to discourse.

1 Like