Skip to content
Snippets Groups Projects
Verified Commit 9edad42d authored by Ing. Klára Moravcová's avatar Ing. Klára Moravcová
Browse files

Modify to be complient to the root module.

parent 31aad998
No related branches found
No related tags found
No related merge requests found
users:
- default
- name: ubuntu
shell: /bin/bash
package_update: true
package_upgrade: true
# Additional worker groups
Every worker node comes with a root disk, with the maximum size defined by its flavor. If you need a larger volume or an additional volume for any reason, you can define an additional volume and attach it to the worker.
```
worker_nodes = [
{
name = "wg-blue"
flavor = "c2.4core-16ram"
volume_size = 30
count = 2
additional_volumes = [
{ size = 20 } # Create 20 GB disk per wroker and attach to the worker.
]
}
]
}
```
After attaching the volume, you need to format and mount it. You can add a script to worker-cloudinit.txt to search for an unmounted device, format it, and mount it. For example, the following script mounts the unmounted device to `/var/lib/containerd`:
```
write_files:
- path: /usr/local/bin/mount-unmounted-disks.sh
permissions: '0755'
content: |
#!/bin/bash
set -e
# Log output for debugging
LOG_FILE="/var/log/cloud-init-unmounted-disks.log"
exec > >(tee -a "${LOG_FILE}") 2>&1
echo "Starting disk discovery and mounting process..."
# Find unmounted disks
UNMOUNTED_DISKS=$(lsblk -ndp -o NAME | while read -r DISK; do
if lsblk -np "$DISK" | grep -q 'part' && mount | grep -q "$(lsblk -np -o NAME "$DISK" | grep part)"; then
continue
else
echo "$DISK"
fi
done)
# Process each unmounted disk
for DISK in $UNMOUNTED_DISKS; do
echo "Processing disk: $DISK"
# Create a single partition (if not already partitioned)
if ! lsblk -np "$DISK" | grep -q 'part'; then
echo "Creating partition on $DISK"
parted --script "$DISK" mklabel gpt
parted --script "$DISK" mkpart primary ext4 0% 100%
PARTITION="${DISK}1"
echo "Created partition: $PARTITION"
else
PARTITION=$(lsblk -np -o NAME "$DISK" | grep 'part' | head -n 1)
echo "Found existing partition: $PARTITION"
fi
# Format the partition if not already formatted
if ! blkid "$PARTITION" >/dev/null 2>&1; then
echo "Formatting partition: $PARTITION"
mkfs.ext4 "$PARTITION"
fi
# Mount the partition
MOUNT_POINT="/var/lib/containerd/"
mkdir -p "$MOUNT_POINT"
echo "Mounting $PARTITION at $MOUNT_POINT"
mount "$PARTITION" "$MOUNT_POINT"
# Add to /etc/fstab for persistence
UUID=$(blkid -s UUID -o value "$PARTITION")
echo "UUID=$UUID $MOUNT_POINT ext4 defaults,nofail 0 2" >> /etc/fstab
done
echo "Disk mounting process completed."
echo "Check ${LOG_FILE} for details."
runcmd:
- /usr/local/bin/mount-unmounted-disks.sh
```
module "kubernetes_infra" { module "kubernetes_infra" {
# source = "./../../kubernetes-infra" # source = "./../../kubernetes-infra"
source = "git::https://gitlab.ics.muni.cz/cloud/terraform/modules/kubernetes-infra.git?ref=v4.0.1" source = "git::https://gitlab.ics.muni.cz/cloud/terraform/modules/kubernetes-infra.git?ref=v5.0.1"
# Example of variable override # Example of variable override
ssh_public_key = "~/.ssh/id_rsa.pub" ssh_public_key = "~/.ssh/id_rsa.pub"
...@@ -10,14 +10,17 @@ module "kubernetes_infra" { ...@@ -10,14 +10,17 @@ module "kubernetes_infra" {
control_nodes_count = 3 control_nodes_count = 3
control_nodes_volume_size = 30 control_nodes_volume_size = 30
control_nodes_flavor = "hpc.8core-16ram" control_nodes_flavor = "r3.4core-8ram-30edisk"
worker_nodes = [ worker_nodes = [
{ {
name = "worker" name = "worker"
flavor = "standard.small" flavor = "c2.4core-16ram"
volume_size = 30 volume_size = 30
count = 2 count = 2
additional_volumes = [
# { size = 20 }
]
} }
] ]
} }
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment