Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
12b621e
Custom changes
samof76 Jan 2, 2023
0720c73
Make some variable changes
samof76 Jan 2, 2023
089a9f1
Adding psi kernel cmdline
samof76 Jan 2, 2023
f283f59
Missed to remove a trailing comma
samof76 Jan 2, 2023
2222a74
Add validation and install falco
samof76 Jan 2, 2023
b8d62bb
disable falco service
samof76 Feb 6, 2023
aa6a26d
Merge branch 'master' of github.com:pych/amazon-eks-ami into custom-c…
samof76 Feb 6, 2023
0766bf6
Missing a comma
samof76 Feb 6, 2023
1154d8f
Merge branch 'master' of github.com:pych/amazon-eks-ami into custom-c…
samof76 Mar 8, 2023
a2e7bcd
Remove the installation of falco
samof76 Mar 8, 2023
1d8ce42
Merge remote-tracking branch 'origin/master' into custom-changes
samof76 May 8, 2023
0f14c12
Changes to use temporary keypairs
samof76 May 8, 2023
3f559a9
Undo temp keys
samof76 May 8, 2023
e4f3801
Merge remote-tracking branch 'origin/custom-changes' into custom-changes
samof76 May 8, 2023
60fb2d8
Merge branch 'master' into custom-changes
samof76 May 22, 2023
59f5837
Add the shell for the disabling auto upgrade
samof76 May 22, 2023
29c9ae6
Adding sed
samof76 May 22, 2023
591ac43
Merge branch 'master' into custom-changes
samof76 May 26, 2023
99fcc27
Merge remote-tracking branch 'origin/master' into custom-changes
samof76 Aug 3, 2023
ede800c
Merge branch 'master' into custom-changes
samof76 Aug 24, 2023
e6a51e4
Changes for sysctl and kubelet config
samof76 Aug 24, 2023
8c21fbe
Merge remote-tracking branch 'samof76/custom-changes' into custom-cha…
samof76 Aug 24, 2023
42e47fd
adding garbage collect changes
samof76 Aug 25, 2023
10dd324
Merge branch 'master' into custom-changes
samof76 Sep 4, 2023
64ed25d
Merge branch 'master' into custom-changes
samof76 Nov 14, 2023
1743f1f
Adding the shutdownGracePeriods by default
samof76 Nov 15, 2023
e7c4d51
Merge branch 'master' into custom-changes
samof76 Feb 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ifeq ($(call vercmp,$(kubernetes_version),gteq,1.25.0), true)
endif

AMI_VERSION ?= v$(shell date '+%Y%m%d')
AMI_VARIANT ?= amazon-eks
AMI_VARIANT ?= fw-eks
ifneq (,$(findstring al2023, $(PACKER_TEMPLATE_FILE)))
AMI_VARIANT := $(AMI_VARIANT)-al2023
endif
Expand Down
12 changes: 6 additions & 6 deletions eks-worker-al2-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"ami_users": "",
"associate_public_ip_address": "",
"aws_access_key_id": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_region": "us-west-2",
"aws_region": "us-east-1",
"aws_secret_access_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"aws_session_token": "{{env `AWS_SESSION_TOKEN`}}",
"binary_bucket_name": "amazon-eks",
Expand All @@ -18,7 +18,7 @@
"docker_version": "20.10.*",
"enable_fips": "false",
"encrypted": "false",
"kernel_version": "",
"kernel_version": "5.10",
"kms_key_id": "",
"launch_block_device_mappings_volume_size": "4",
"pause_container_version": "3.5",
Expand All @@ -31,9 +31,9 @@
"source_ami_owners": "137112412989",
"ssh_interface": "",
"ssh_username": "ec2-user",
"ssm_agent_version": "",
"subnet_id": "",
"temporary_security_group_source_cidrs": "",
"volume_type": "gp2",
"subnet_id": "subnet-061fd55369909b950",
"volume_type": "gp3",
"temporary_security_group_source_cidrs": "10.102.8.0/21",
"ssm_agent_version": "latest",
"working_dir": "{{user `remote_folder`}}/worker"
}
32 changes: 32 additions & 0 deletions eks-worker-al2.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
"ami_regions": "{{user `ami_regions`}}",
"ssh_username": "{{user `ssh_username`}}",
"ssh_interface": "{{user `ssh_interface`}}",
"ssh_keypair_name": "packer-key",
"ssh_private_key_file": "~/.ssh/id_rsa",
"temporary_security_group_source_cidrs": "{{user `temporary_security_group_source_cidrs`}}",
"security_group_id": "{{user `security_group_id`}}",
"associate_public_ip_address": "{{user `associate_public_ip_address`}}",
Expand Down Expand Up @@ -134,6 +136,31 @@
"ADDITIONAL_YUM_REPOS={{user `additional_yum_repos`}}"
]
},
{
"type": "shell",
"remote_folder": "{{ user `remote_folder`}}",
"expect_disconnect": true,
"script": "{{template_dir}}/scripts/upgrade_kernel.sh",
"environment_vars": [
"KUBERNETES_VERSION={{user `kubernetes_version`}}",
"KERNEL_VERSION={{user `kernel_version`}}"
]
},
{
"type": "shell",
"pause_before": "90s",
"remote_folder": "{{ user `remote_folder`}}",
"expect_disconnect": true,
"script": "{{template_dir}}/scripts/add_psi.sh"
},
{
"type": "shell",
"pause_before": "90s",
"remote_folder": "{{ user `remote_folder`}}",
"inline": [
"mkdir -p /tmp/worker/log-collector-script/"
]
},
{
"type": "file",
"source": "{{template_dir}}/files/",
Expand Down Expand Up @@ -220,6 +247,11 @@
"KERNEL_VERSION={{user `kernel_version`}}"
]
},
{
"type": "shell",
"remote_folder": "{{ user `remote_folder`}}",
"script": "{{template_dir}}/scripts/disable_auto_upgrade.sh"
},
{
"type": "shell",
"remote_folder": "{{ user `remote_folder`}}",
Expand Down
33 changes: 32 additions & 1 deletion files/kubelet-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,36 @@
"protectKernelDefaults": true,
"serializeImagePulls": false,
"serverTLSBootstrap": true,
"tlsCipherSuites": ["TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305", "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305", "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_RSA_WITH_AES_256_GCM_SHA384", "TLS_RSA_WITH_AES_128_GCM_SHA256"]
"tlsCipherSuites": [
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
"TLS_RSA_WITH_AES_256_GCM_SHA384",
"TLS_RSA_WITH_AES_128_GCM_SHA256"
],
"kubeAPIBurst": 50,
"kubeAPIQPS": 50,
"eventRecordQPS": 50,
"eventBurst": 50,
"registryPullQPS": 100,
"registryBurst": 100,
"runtimeRequestTimeout": "15s",
"allowedUnsafeSysctls": [
"net.core.somaxconn",
"net.ipv4.tcp_keepalive_*",
"net.core.rmem_max",
"net.core.wmem_max",
"net.core.rmem_default",
"net.core.wmem_default",
"net.core.optmem_max",
"net.ipv4.tcp_rmem",
"net.ipv4.tcp_wmem"
],
"imageGCHighThresholdPercent": 70,
"imageGCLowThresholdPercent": 50,
"shutdownGracePeriodCriticalPods": "360s",
"shutdownGracePeriod": "420s"
}
9 changes: 9 additions & 0 deletions scripts/add_psi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -o pipefail
set -o nounset
set -o errexit

sudo grubby --args="psi=1" --update-kernel /boot/vmlinuz-$(uname -r)

sudo reboot
6 changes: 6 additions & 0 deletions scripts/disable_auto_upgrade.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# This script is used to disable auto-upgrade on the Amazon Linux 2 AMI.
# It is run as part of the AMI build process.

sudo sed -i 's/^repo_upgrade: .*/repo_upgrade: none/' /etc/cloud/cloud.cfg
3 changes: 3 additions & 0 deletions scripts/install-worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,9 @@ EOF
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
echo fs.inotify.max_user_instances=8192 | sudo tee -a /etc/sysctl.conf
echo vm.max_map_count=524288 | sudo tee -a /etc/sysctl.conf
echo net.netfilter.nf_conntrack_tcp_timeout_time_wait=65 | sudo tee -a /etc/sysctl.conf
echo net.core.somaxconn=65535 | sudo tee -a /etc/sysctl.conf
echo "@reboot /bin/bash -l -c '/sbin/modprobe nf_conntrack; /usr/sbin/sysctl -p'" | sudo crontab -
echo 'kernel.pid_max=4194304' | sudo tee -a /etc/sysctl.conf

################################################################################
Expand Down
11 changes: 11 additions & 0 deletions scripts/install_falco.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -o pipefail
set -o nounset
set -o errexit

sudo rpm --import https://falco.org/repo/falcosecurity-3672BA8F.asc
sudo curl -s -o /etc/yum.repos.d/falcosecurity.repo https://falco.org/repo/falcosecurity-rpm.repo
sudo yum install -y kernel-devel-$(uname -r)
sudo yum install -y falco
sudo systemctl disable falco
14 changes: 14 additions & 0 deletions scripts/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ else
exit 1
fi

cmdline=$(cat /proc/cmdline)
echo "Verifying if psi kernel cmdline arg is set"

if [[ $cmdline =~ "psi=1" ]]; then
echo "psi is set"
else
echo "psi is not set"
exit 1
fi

# echo "Verifying is falco driver is loaded"
# sudo lsmod | grep -i falco
echo "Verifying that the package versionlocks are correct..."

function versionlock-entries() {
# the format of this output is EPOCH:NAME-VERSION-RELEASE.ARCH
# more info in yum-versionlock(1)
Expand Down