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
Juju must be able to allocate operator storage, but will use a suitable storage class already created on the cluster if one is available.
The easy way
Using existing storage class
Juju can use any storage class already created, according to a specified selection criteria. In order, Juju will look for a storage class:
with the label juju-storage=<appname>-operator-storage
with the label juju-storage=<modelname>-operator-storage
with the label juju-storage=default
with the annotation storageclass.kubernetes.io/is-default-class=true ie the cluster default
Bespoke Operator Storage Configuration
You can create a Juju storage pool called operator-storage with the provider type kubernetes, which will be used in preference to searching for an pre-existing storage class as outlined above. You may want to do this to provided customised storage for the operators.
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:
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:
storage class called “juju-operator-storage”
storage class with label “juju-storage”, one of:
<app>-operator-storage
<model>
"default"
storageclass.kubernetes.io/is-default-class
The above is for operator storage. For Juju units themselves, it’s similar.
storage class called “juju-unit-storage”
storage class with label “juju-storage”, one of:
<app>-unit-storage
<model>
"default"
storageclass.kubernetes.io/is-default-class
Some general Juju storage doc is here. But it’s being migrated to discourse.