After disabling the public endpoint on a GKE cluster, an IP that was previously in authorized networks can still reach the API server via the public IP, even though authorized networks is now empty and gcpPublicCidrsAccessEnabled is false. All other IPs are blocked as expected.
Order of operations:
Public endpoint enabled, authorized networks contained one external IP
--enable-private-endpoint
Removed that IP from authorized networks
On other clusters where we cleared authorized networks first and then disabled the public endpoint, access was correctly blocked.
How can we clear this residual access without disruptive operations like IP rotation?
After disabling the public endpoint on a GKE cluster, an IP that was previously in authorized networks can still reach the API server via the public IP, even though authorized networks is now empty and gcpPublicCidrsAccessEnabled is false. All other IPs are blocked as expected.
Order of operations:
Public endpoint enabled, authorized networks contained one external IP
–enable-private-endpoint
Removed that IP from authorized networks
Even when you set --enable-private-endpoint, the GKE control plane VMs retain their external IP address for Google’s cluster management. Toggling --enable-private-endpoint only flips the endpoint flag in cluster metadata - it doesn’t reconcile the underlying control plane ingress firewall rules on its own. My assumption is that when you disabled the public endpoint while the external IP was still in authorized networks and then cleared the list afterward, the underlying control plane allowlist rule in the Google-managed project got out of sync and didn’t purge that /32 entry (or, if you’re testing from a client with an active kubectl session, stateful GCE firewall connection tracking is still permitting an already-established TCP flow on port 443).
On other clusters where we cleared authorized networks first and then disabled the public endpoint, access was correctly blocked.
How can we clear this residual access without disruptive operations like IP rotation?
First, test with a fresh TCP connection (for example, curl --connect-timeout 5 -k https://<PUBLIC_IP>/version) to rule out an existing HTTP/2 keepalive session held open in GCE’s stateful connection table. If new TCP handshakes still succeed, you don’t need to run an IP rotation - you just need to force GKE’s control plane firewall controller to overwrite and delete the stale allowlist rule. You can do this non-disruptively by either 1) temporarily re-enabling the public endpoint (--no-enable-private-endpoint or --enable-public-endpoint) while authorized networks is empty and then setting --enable-private-endpoint again to replay the clean transition order, or 2) adding a dummy RFC 1918 /32 CIDR to authorized networks, updating it once to force an in-place overwrite of the underlying firewall rule’s sourceRanges, and then clearing the list:
# 1. Add a dummy RFC 1918 /32 CIDR (private endpoint mode only accepts private ranges)
gcloud container clusters update <CLUSTER_NAME> \
--location=<LOCATION> \
--enable-master-authorized-networks \
--master-authorized-networks=192.168.255.254/32
# 2. Modify the dummy CIDR once so GKE executes an in-place firewall update (0 -> 1 only runs an insert-if-missing check)
gcloud container clusters update <CLUSTER_NAME> \
--location=<LOCATION> \
--enable-master-authorized-networks \
--master-authorized-networks=192.168.255.253/32
# 3. Clear authorized networks to trigger deletion of the control plane allowlist rule
gcloud container clusters update <CLUSTER_NAME> \
--location=<LOCATION> \
--enable-master-authorized-networks \
--master-authorized-networks=""
Sorry for the confusion — I tried again after leaving it overnight, and it looks like the previously authorized IP can no longer access the cluster either.
I’m not sure why there was such a delay before the change took effect.
Anyway, the issue seems to be resolved for now. Thanks again for your help.