Some workloads need different volumes with different storage capacities to fit their components needs. These volumes are stored in LVM Logical Volumes <LVM LV>
.
Considering all storage volumes required for workloads running in the cluster, create a configuration as below:
metalk8s_lvm_drives_vg_metalk8s: ['/dev/vdb']
metalk8s_lvm_lvs_vg_metalk8s:
lv01:
size: 52G
lv02:
size: 52G
lv03:
size: 52G
lv04:
size: 11G
lv05:
size: 11G
lv06:
size: 11G
lv07:
size: 5G
lv08:
size: 5G
This configuration can be set on a whole Ansible group of nodes (see ansible:group_variables
), or on a specific host (see ansible:host_variables
).
Volumes can be resized (one or several at once). Change the volume size value to a higher one and run:
ansible-playbook -b -i <inventory>/hosts -t storage playbooks/deploy.yml
The configuration can be applied to groups and hosts in two different ways.
Note
Configuration files are merged for every created host or group.
To apply a configuration, create a YAML file in either (or both) group_vars
and host_vars
with the group name associated, or create a folder in group_vars
or host_vars
with several YAML files. The ansible-playbook
above must be run.
It is possible to configure LVM drives and volumes for one node only.
Exemplified below, a default storage configuration (group_vars/kube-node/storage.yml
):
# metalk8s_lvm_vgs = ['vg_metalk8s']
metalk8s_lvm_drives_vg_metalk8s: ['/dev/vdb']
metalk8s_lvm_lvs_vg_metalk8s:
lv01:
size: 52G
lv02:
size: 52G
lv03:
size: 52G
In host_vars
, create a new file (host_vars/node_1.yml
):
metalk8s_lvm_vgs = ['vg_metalk8s', 'mynewvg']
metalk8s_lvm_drives_mynewvg: ['/dev/vdc']
metalk8s_lvm_lvs_vg_metalk8s:
lv01:
size: 52G
metalk8s_lvm_lvs_mynewvg:
lv01:
size: 1T
Except node_1
, every machine has a single vg_metalk8s with six logical volumes <LVM LV>
(three specified, three default). On node_1
, there are two volume groups <LVM VG>
(vg_metalk8s and mynewvg) with four logical volumes on vg_metalk8s (one specified, three default) and one logical volume on mynewvg.
Note
As the volume group name becomes a prefix, several LVs can have the same name.