diff --git a/cluster/gce/config-default.sh b/cluster/gce/config-default.sh index 3eb31348786..18688aecd41 100755 --- a/cluster/gce/config-default.sh +++ b/cluster/gce/config-default.sh @@ -186,7 +186,7 @@ if [[ ${ENABLE_METADATA_CONCEALMENT:-} == "true" ]]; then # Put the necessary label on the node so the daemonset gets scheduled. NODE_LABELS="${NODE_LABELS},beta.kubernetes.io/metadata-proxy-ready=true" # 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 # Optional: Enable node logging. diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index b29063d0182..93b92b5b375 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -216,7 +216,7 @@ if [[ ${ENABLE_METADATA_CONCEALMENT:-} == "true" ]]; then # Put the necessary label on the node so the daemonset gets scheduled. NODE_LABELS="${NODE_LABELS},beta.kubernetes.io/metadata-proxy-ready=true" # 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 # Optional: Enable node logging. diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index 53aaa48fd52..157f82e417f 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -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 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" 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