Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add iptables rules to enforce access to kubelet and nodeports #1779

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions templates/al2/provisioners/install-worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,20 @@ sudo systemctl restart sshd.service
### iptables ###################################################################
################################################################################

# open access to kubelet
iptables -A INPUT -p tcp -m tcp --dport 10250 -m state --state NEW -j ACCEPT

# open access for NodePorts
iptables -A INPUT -p tcp -m multiport --dports 30000:32767 -j ACCEPT

# open input, output and forward by default
iptables -P FORWARD ACCEPT
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT

# save updated iptables
bash -c "/sbin/iptables-save > /etc/sysconfig/iptables"

sudo mv $WORKING_DIR/iptables-restore.service /etc/eks/iptables-restore.service

################################################################################
Expand Down
1 change: 0 additions & 1 deletion templates/al2/runtime/kubelet.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ After=docker.service iptables-restore.service
Requires=docker.service

[Service]
ExecStartPre=/sbin/iptables -P FORWARD ACCEPT -w 5
ExecStart=/usr/bin/kubelet \
--config /etc/kubernetes/kubelet/kubelet-config.json \
--kubeconfig /var/lib/kubelet/kubeconfig \
Expand Down