This message was deleted.
# elemental
a
This message was deleted.
s
We have not experimented with such a setup. As you mention not a common setup for k8s. Currently there is not explicit support from an Elemental PoV, however this could be achieved with some custom installation to set some custom persistent partition size so it leaves some part of the disk free and then you could also include an after-install-hook to create a swap partition on disk free area.
See https://elemental.docs.rancher.com/customizing#custom-elemental-client-configuration-file for adding a custom
/elemental/config.d/custom.yaml
to configure partitions. Elemental installer cannot create a swap partition (even it should not be hard to add implement) however it can define size if all current partitions, then if the disk is bigger it will just let some free space which could later on be partitioned for swap in an install hook.
f
hi David, thanks for reaching out, we will try this
s
Good, let us know if you need further hints to set custom partitions.
e
Creating a swapfile and activating it during cloud-init stage "fs" (when not in live-mode) worked for me.
Copy code
name: "Setup swap"
stages:
  fs:
    - name: "Enable Swap"
      if: '[ ! -f "/run/cos/live_mode" ]'
      commands:
      - |
        dd if=/dev/zero of=/usr/local/swapfile bs=1M count=1000
        chmod 0600 /usr/local/swapfile
        mkswap /usr/local/swapfile
        swapon /usr/local/swapfile
🙌 1