Skip to content

[CPCAP-12251] feature: fsmount - #824

Closed
alexarefev wants to merge 30 commits into
mainfrom
feature/fsmount
Closed

alexarefev wants to merge 30 commits into
mainfrom
feature/fsmount

Conversation

@alexarefev

@alexarefev alexarefev commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Description

  • The functionality to mount some storage before the k8s installation is needed
  • The ZRAM storage for /var/log/pods must be add to configuration, but disabled by default

Solution

  • Add new task fsmount into preparation section with the following description:
services:
  fsmount:
  - name: fs1
    size: 1G
    type: ext4
    device: /dev/sdd1
    path: /mnt
    template:
      source: templates/plugins/fsmount-setup.service.j2
      destination: /etc/systemd/system/fsmount-setup.service
    preparation_scripts:
      - resources/scripts/upgrade_kernel.sh
      - resources/scripts/fsprep.sh
	groups: [control-plane, workers]
	nodes: []

name - name of the item just for indication
enabled - defines if the item must be processed
device - the device file
path - the mount point
size - the size of the disk, it's needed for example for tmpfs (optional)
template.source - the path to systemctl unit template that should be rendered by the options above
template.destination - the path where the systemctl unit must be put on the cluster node
preparation_script - the script that must be finished successfully to initiate the filesystem creation (optional); basically it install necessary packages, modules and so no to run systemctl unit successfully; if it finishes with error fsmount task for that item must be skipped
groups - the list of the nodes roles where the task must be applied (optional)
nodes - the list of the nodes where the task must be applied (optional)
groups and nodes must be merged before the run; if both groups and nodes are empty - the task is skipped

  • Add template, script for ZRAM storage
  • Add check_paas task
  • Update documentation

Test Cases

TestCase 1

Check if the installation procedure is working

Test Configuration:

  • Hardware: 2CPU/4GB
  • OS: Ubuntu 24.04
  • Inventory: Allinone

Steps:

  1. Run kubemarine install with the following settings in cluster.yaml:
services:
  kubeadm_kubelet:
    containerLogMaxSize: 5Mi
    containerLogMaxFiles: 2
  fsmount:
  - name: zram
    size: 1G
    type: ext4
    device: /dev/zram0
    path: /var/log/pods
    template:
      source: templates/zram-setup.service.j2
      destination: /etc/systemd/system/zram-setup.service
    preparation_scripts:
      - resources/scripts/upgrade_kernel.sh
      - resources/scripts/zram.sh
    groups: [control-plane, worker]

Results:

Before After
not applicable /dev/zram0 is mounted to /var/log/pods; containerLogMax options are set in /var/lib/kubelet/config.yaml

TestCase 2

Check if the mount_fs procedure is working

Test Configuration:

  • Hardware: 2CPU/4GB
  • OS: Ubuntu 24.04
  • Inventory: Allinone

Steps:

  1. Run kubemarine reconfigure on existing cluster with the following settings in procedure.yaml:
services:
  kubeadm_kubelet:
    containerLogMaxSize: 5Mi
    containerLogMaxFiles: 2
  1. Run kubemarine mount_fs on existing cluster with the following settings in procedure.yaml:
fsmount:
  - name: zram
    size: 1G
    type: ext4
    device: /dev/zram0
    path: /var/log/pods
    template:
      source: templates/zram-setup.service.j2
      destination: /etc/systemd/system/zram-setup.service
    preparation_scripts:
      - resources/scripts/upgrade_kernel.sh
      - resources/scripts/zram.sh
    groups: [control-plane, worker]
reboot: true

Results:

Before After
not applicable /dev/zram0 is mounted to /var/log/pods; containerLogMax options are set in /var/lib/kubelet/config.yaml

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • There is no breaking changes, or migration patch is provided
  • Integration CI passed
  • Unit tests. If Yes list of new/changed tests with brief description
  • There is no merge conflicts

@alexarefev alexarefev changed the title feature: fsmount [CPCAP-12251] feature: fsmount Aug 3, 2026
@alexarefev
alexarefev marked this pull request as ready for review August 11, 2026 09:01

@disa1217 disa1217 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexarefev , checked.

@alexarefev
alexarefev marked this pull request as draft August 17, 2026 10:41
@alexarefev
alexarefev marked this pull request as ready for review August 17, 2026 12:38
Comment thread docs/public/Installation.md
Comment thread kubemarine/fsmount.py
Comment thread kubemarine/resources/scripts/zram.sh
Comment thread kubemarine/templates/zram-setup.service.j2
@alexarefev
alexarefev marked this pull request as draft August 18, 2026 12:05
@alexarefev
alexarefev marked this pull request as ready for review August 20, 2026 09:58
Comment thread docs/public/Installation.md
Comment thread docs/public/Maintenance.md

@disa1217 disa1217 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexarefev , checked the documents.

Comment thread docs/public/Maintenance.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants