I have a GCP project with:
subnet0
: cidr 10.1.0.0/24
subnet1
: cidr 10.2.0.0/24
subnet0
subnet and:
172.16.0.0/18
172.16.64.0/20
gke-pool
subnet1
subnet and tags agent
I would like to create a firewall rules that would allow pods in the GKE cluster to connect to the VM, so I have created the following firewall rule:
network
: VPC
direction
: INGRESS
gke-pool
agent
But it does not work.
Instead if I set the source range to the pods cidr (172.16.0.0/18
) it works.
Any suggestions?
That's because you are using a VPC Native Cluster. VPC Native clusters are the default mode and they made the Pod IP's visible in the VPC. This means when a pod talks to a destination which is on VPC, the IP of the Pod is NOT Source Nated behind the Node IP.
You have two options: