Created
August 21, 2020 04:35
-
-
Save christarazi/11aadf01d353112eb10ed82373569155 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
pod="${1}" # Cilium pod name (e.g. cilium-2341d) | |
op="${2}" # iptables operation (e.g. append or delete) | |
etcd="${3}" # Etcd node IP to apply iptable rules to (e.g. hostname or IP addr) | |
if [[ "${op}" == "append" ]]; then | |
op="-A" | |
else | |
op="-D" | |
fi | |
set -x | |
kubectl -n kube-system exec -it "${pod}" -- bash -c " | |
iptables ${op} INPUT -s ${etcd} -p TCP --sport 2379 -j DROP | |
iptables ${op} OUTPUT -d ${etcd} -p TCP --dport 2379 -j DROP | |
" | |
set +x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment