Context
Standing up our first production GKE platform meant no internal playbook — nobody on the team had hit GCP-specific problems like these before. Two bugs in particular cost real time to trace, because neither failed in an obvious way.
Bug 1 — PSC mode silently and permanently locks the public endpoint
Setting private_endpoint_subnetwork on the GKE Terraform module — needed for the private cluster setup — silently flips privateEndpointEnforcementEnabled: true on the cluster. That flag can't be reverted by any terraform apply or gcloud update, even with enable_private_endpoint = false and open master_authorized_networks. The only fix is full cluster recreation without that field set at all.
I hit this when our automation lost the ability to reach the cluster mid-build, ruled out the obvious suspects (authorized networks, firewall rules) first, and only found the real cause by describing the live cluster's full config and comparing it against what Terraform thought it had set.
Bug 2 — default ip-masq-agent rules blocked GitOps bootstrapping
On a brand-new GKE cluster, the default ip-masq-agent config treats 172.16.0.0/12 as non-masquerade — but our Git hosting lived inside that range. That meant the GitOps controller's pod IP was used as the source address when it tried to reach Git, and that IP wasn't routable back — bootstrapping just silently stalled, with nothing pointing at ip-masq-agent as the cause.
Fixed it by applying a corrected ip-masq-agent ConfigMap (explicit pod/service CIDRs, masqLinkLocal: false) before GitOps bootstrap, then codified it directly into Terraform as a kubernetes_config_map_v1 resource driven by the VPC's actual pod/service ranges — so every future cluster recreation gets it automatically instead of relying on someone remembering a manual step.
What I'd want next time
Both of these are now pre-flight checks for any future GKE platform build: assume a private endpoint plus GitOps bootstrapping needs explicit ip-masq-agent config, and never assume a private-endpoint-related field is reversible without checking first.