Juju operator storage


What is operator storage

Juju creates a so-called operator pod for each deployed application. The operator pod is responsible for running the charm hooks for each deployed unit’s charm. Each charm needs persistent storage so that charm state, resources etc can be preserved if the pod restarts.

Operator storage is mandatory
You must create a Juju storage pool called operator-storage with the provider type kubernetes.
If no such storage pool exists, you can’t deploy any Kubernetes charms.


As with charm storage, operator storage is set up by defining a Juju storage pool which maps to a Kubernetes storage class. For operators, a specially named operator-storage pool is used.

AWS using EBS volumes

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

GKE using Persistent Disk

juju create-storage-pool operator-storage kubernetes storage-class=juju-operator-storage storage-provisioner=kubernetes.io/gce-pd parameters.type=pd-standard

microk8s using built-in hostPath storage

juju create-storage-pool operator-storage kubernetes storage-class=microk8s-hostpath

Any storage provisioner may be used. The only requirement is that the storage pool be named operator-storage.


Getting Started

This is mainly to try and flesh out some details in the above post…

So if I have a default storage class setup on my Kubernetes cluster am I good to go here? Can I make a storage class in Kubernetes called operator-storage? If I have a bare metal MaaS deployment, how would I create a storage pool in Juju to use here?

Note that I am coming at this from the Kubernetes side and haven’t used Juju storage much, but it’s very possible that others would in the same boat. Maybe some links to Juju storage docs?


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
  name: k8s-ebs
provisioner: kubernetes.io/aws-ebs
  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.

Juju 2.5.0 Beta 3 Release Notes
Google GKE now supported!