Find a file
2024-02-10 22:27:32 +01:00
.gitignore Add .gitignore 2024-01-11 14:45:13 +01:00
chrony.conf Add userdefine cloudinit to kubernetes nodes 2024-01-12 14:08:02 +01:00
flavors.tf Add some flavors 2024-01-11 15:00:02 +01:00
images.tf Add ubuntu image to be used by microk8s 2024-01-11 15:19:38 +01:00
keypairs.tf Add keypairs 2024-01-11 15:04:16 +01:00
kube-user.tpl Mount /var/snap as a last step 2024-01-12 16:09:45 +01:00
kube.tf Begin lb deployment 2024-02-10 22:27:32 +01:00
lb.tf Begin lb deployment 2024-02-10 22:27:32 +01:00
main.tf Initial commit 2024-01-11 14:26:02 +01:00
network.tf Create port for kubernetes nodes. 2024-01-11 15:34:07 +01:00
README.md Add section on tofu tool useage in README.md 2024-01-16 16:03:55 +01:00
securitygroups.tf Begin lb deployment 2024-02-10 22:27:32 +01:00
variables.tf Begin lb deployment 2024-02-10 22:27:32 +01:00

Matrixtest-IaC

This opentofu project creates a three node cluster in openstack.

In this case a microk8s cluster.

The following tasks is executed by this tofu deployment.

  • Creates a custom security group with rules to accept traffic between the nodes.
  • Create an os volume from the debian-12 image.
  • Create an snap volume to be used as an LVM volume for easy resize and mounted on /lib/snap.
  • Query all security groups in the project.
  • Create an network port for each node and use a selection of the queried security groups.
  • Create an instance with os volume, snap volume and port attached and a custom cloudinit config.

Auth is provided to the openstack provider by environment variables. Source the rc file of app credentials for the desired openstack project. Run "tofu plan" to se the planed changes. Run "tofu apply" to apply the changes.

Cloudinit config.

Cloudinit does the following tasks.

  • Install tools for LVM2,XFS and the Chronyd ntp sevice.
  • Configure Chronyd to use netnod.se as a source.
  • Configure a lvol_snap LVM volume and format it with XFS.
  • Add a mount record of the lvm volume in fstab and verifies it.

Expansion of volume by online resize

To expand the attached snap volume first query the api version of the volume endpoint from the management node and set the new size of the volume.

  • curl -L https://v2.api.dco.safedc.net:8776/ | jq '.versions[1].version' # Returns 3.60
  • openstack --os-volume-api-version 3.60 volume set --size 30 6f1a238d-f746-4604-92c9-0985ad4b83fd

From inside the instance run the following commands.

  • sudo pvresize /dev/sdb
  • sudo lvresize -l +100%FREE snapvg/lvol_snap
  • sudo xfs_growfs /dev/snapvg/lvol_snap

Now we have expanded the mounted device with zero downtime.