diff --git a/sysbox-eks.pkr.hcl b/sysbox-eks.pkr.hcl index 81d932d..5223c85 100644 --- a/sysbox-eks.pkr.hcl +++ b/sysbox-eks.pkr.hcl @@ -99,6 +99,22 @@ build { "source.amazon-ebs.ubuntu-eks", ] + provisioner "shell" { + inline_shebang = "/usr/bin/env bash" + inline = [ + "set -o pipefail -o errexit", + + "echo '>>> Use cgroup2'", + "sudo sed --in-place 's/GRUB_CMDLINE_LINUX_DEFAULT=\"console=tty1 console=ttyS0 nvme_core.io_timeout=4294967295\"/GRUB_CMDLINE_LINUX_DEFAULT=\"console=tty1 console=ttyS0 nvme_core.io_timeout=4294967295 systemd.unified_cgroup_hierarchy=1\"/g' /etc/default/grub.d/50-cloudimg-settings.cfg", + "sudo update-grub", + "sudo systemctl reboot" + ] + + expect_disconnect = true + skip_clean = true + pause_after = "10s" + } + provisioner "shell" { inline_shebang = "/usr/bin/env bash" inline = [ @@ -299,6 +315,7 @@ build { } provisioner "file" { + # reference: https://github.com/awslabs/amazon-eks-ami/blob/main/templates/al2/runtime/bootstrap.sh source = "bootstrap.sh.patch" destination = "/home/ubuntu/bootstrap.sh.patch" } @@ -434,4 +451,15 @@ build { ] } + provisioner "shell" { + inline_shebang = "/usr/bin/env bash" + inline = [ + "set -o pipefail -o errexit", + + "echo '>>> Patching kubelet config'", + "sudo dasel put bool --parser json --file /etc/kubernetes/kubelet/kubelet-config.json --selector 'failSwapOn' false", + "sudo dasel put bool --parser json --file /etc/kubernetes/kubelet/kubelet-config.json --selector 'featureGates.NodeSwap' true", + "sudo dasel put string --parser json --file /etc/kubernetes/kubelet/kubelet-config.json --selector 'memorySwap.swapBehavior' 'UnlimitedSwap'", + ] + } }