To provision persistent volume storage, you need to use standard Juju storage primitives. The YAML sent by the charm is not used for this as you have found. Here’s a link to get started:
The doc is slightly out of date (an update is being worked on) in that for recent versions of Juju you no longer need to create a storage pool unless you want to. Juju will use the cluster default storage class if one is defined. If not, you will need to use a storage pool to tell Juju how to request storage be provisioned.
If you want a really simple example, look say at the demo mariadb charm. The charm declares that it wants some file storage:
"storage":
"database":
"type": "filesystem"
"location": "/var/lib/mysql"
When you deploy the charm, Juju will ask k8s to create a persistent volume which will be mounted into the pod at the specified location. By default, the claim will be 1GB but you can request more, eg
juju deploy cs:~juju/mariadb-k8s --storage database=10G
To pass parameters to the k8s provisioner, set up a Juju storage class, eg
juju create-storage-pool k8s-ebs storage-class=juju-ebs storage-provisioner=kubernetes.io/aws-ebs parameters.type=gp2
In Juju 2.6 beta1 you can also make use of the k8s emptyDir
storage backend which maps to the standard Juju tmpfs
(for in memory) or rootfs
(for pod root disk) storage types. eg
juju deploy cs:~juju/mariadb-k8s --storage database=tmpfs,100M
or
juju deploy cs:~juju/mariadb-k8s --storage database=rootfs,1G