mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-15 14:14:39 +00:00
Introduce METADATA_CONCEALMENT_NO_FIREWALL to prevent firewall from being set
This commit is contained in:
@@ -186,7 +186,7 @@ if [[ ${ENABLE_METADATA_CONCEALMENT:-} == "true" ]]; then
|
|||||||
# Put the necessary label on the node so the daemonset gets scheduled.
|
# Put the necessary label on the node so the daemonset gets scheduled.
|
||||||
NODE_LABELS="${NODE_LABELS},beta.kubernetes.io/metadata-proxy-ready=true"
|
NODE_LABELS="${NODE_LABELS},beta.kubernetes.io/metadata-proxy-ready=true"
|
||||||
# Add to the provider custom variables.
|
# Add to the provider custom variables.
|
||||||
PROVIDER_VARS="${PROVIDER_VARS:-} ENABLE_METADATA_CONCEALMENT"
|
PROVIDER_VARS="${PROVIDER_VARS:-} ENABLE_METADATA_CONCEALMENT METADATA_CONCEALMENT_NO_FIREWALL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Optional: Enable node logging.
|
# Optional: Enable node logging.
|
||||||
|
@@ -216,7 +216,7 @@ if [[ ${ENABLE_METADATA_CONCEALMENT:-} == "true" ]]; then
|
|||||||
# Put the necessary label on the node so the daemonset gets scheduled.
|
# Put the necessary label on the node so the daemonset gets scheduled.
|
||||||
NODE_LABELS="${NODE_LABELS},beta.kubernetes.io/metadata-proxy-ready=true"
|
NODE_LABELS="${NODE_LABELS},beta.kubernetes.io/metadata-proxy-ready=true"
|
||||||
# Add to the provider custom variables.
|
# Add to the provider custom variables.
|
||||||
PROVIDER_VARS="${PROVIDER_VARS:-} ENABLE_METADATA_CONCEALMENT"
|
PROVIDER_VARS="${PROVIDER_VARS:-} ENABLE_METADATA_CONCEALMENT METADATA_CONCEALMENT_NO_FIREWALL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Optional: Enable node logging.
|
# Optional: Enable node logging.
|
||||||
|
@@ -77,7 +77,9 @@ function config-ip-firewall {
|
|||||||
iptables -w -t nat -A IP-MASQ -m comment --comment "ip-masq: outbound traffic is subject to MASQUERADE (must be last in chain)" -j MASQUERADE
|
iptables -w -t nat -A IP-MASQ -m comment --comment "ip-masq: outbound traffic is subject to MASQUERADE (must be last in chain)" -j MASQUERADE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${ENABLE_METADATA_CONCEALMENT:-}" == "true" ]]; then
|
# If METADATA_CONCEALMENT_NO_FIREWALL is set, don't create a firewall on this
|
||||||
|
# node because we don't expect the daemonset to run on this node.
|
||||||
|
if [[ "${ENABLE_METADATA_CONCEALMENT:-}" == "true" ]] && [[ ! "${METADATA_CONCEALMENT_NO_FIREWALL:-}" == "true" ]]; then
|
||||||
echo "Add rule for metadata concealment"
|
echo "Add rule for metadata concealment"
|
||||||
iptables -w -t nat -I PREROUTING -p tcp -d 169.254.169.254 --dport 80 -m comment --comment "metadata-concealment: bridge traffic to metadata server goes to metadata proxy" -j DNAT --to-destination 127.0.0.1:988
|
iptables -w -t nat -I PREROUTING -p tcp -d 169.254.169.254 --dport 80 -m comment --comment "metadata-concealment: bridge traffic to metadata server goes to metadata proxy" -j DNAT --to-destination 127.0.0.1:988
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user