Upcoming in 2.8 - Support for storage on Deployments and DaemonSets

New in 2.8 beta1…

Juju k8s charms are able to specify a deployment type:

  • stateless (maps to DeploymentController)
  • stateful (maps to StatefulSet)
  • daemon (maps to DaemonSet)

Until now, if a charm wanted to declare storage, Juju required that a StatefulSet be used.

It’s now possible for a charm to use Juju storage and have its workload provisioned as a DeploymentController or DaemonSet. Such deployments need to have the shared) volume mounted with access mode as ReadWriteMany or ReadOnlyMany. The way to specify this in Juju is to create a storage pool with the new storage-mode attribute set. The storage pool will specify the k8s StorageClass to use, and the access mode. This storage pool is then used at deploy time with the relevant --storage directive.

A storage pool used for k8s can refer to an existing storage class or specify a provisioner to use and Juju will create a new storage class with that provisioner.

For this example we’ll refer to an existing storage class.

$ kubectl get sc
mysc (default)   microk8s.io/hostpath   Delete          Immediate           false                  7d

Create a storage pool

$ juju create-storage-pool myrwx-storage storage-class=mysc storage-mode=RWX

Deploy a charm with storage

$ juju deploy mycharm --storage database=myrwx-storage,1G

Check that the volume claim is correctly set up

$ kubectl -n test get pvc
NAME                          STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
database-ab043c08-mycharm-0   Bound    pvc-f2ea9bc5-0a61-43ac-b7d2-65dae5d4400d   1Gi        RWX            mysc           88m