we're trying to block all non-cluster traffic except a few external IP addresses based on this Cloud Armor walk through.
The GKE cluster recognizes the rules but it's still blocking the allowed IP. Here are the steps followed:
1) Create the policy + rules
gcloud beta compute security-policies create allow-team-only \
--description "Cloud Armor deny non-team IPs"
gcloud beta compute security-policies rules create 1000 \
--security-policy allow-team-only \
--description "Deny traffic from 0.0.0.0/0." \
--src-ip-ranges "0.0.0.0/0" \
--action "deny-404"
gcloud beta compute security-policies rules create 999 \
--security-policy allow-team-only \
--description "Allow traffic from <IP ADDRESS>." \
--src-ip-ranges "<IP ADDRESS>/32" \
--action "allow"
2) Apply the rules to our services, which are on port 8080
metadata:
annotations:
beta.cloud.google.com/backend-config: '{"ports": {"8080":"allow-team-only"}}'
What am I overlooking?
Thanks!
For those struggling with this, check your logs first, and then confirm that your IP address doesn't rotate. I was on a public network that had rotating IPs, which I did not know about.