Prepare and test your skills
Prepare and test your skills
Compute Engine and Google Kubernetes Engine (GKE) network architecture is how virtual machines and Kubernetes Pods communicate securely inside a Virtual Private Cloud network. In this architecture, every Compute Engine (opens in a new tab) virtual machine (VM) and Google Kubernetes Engine (GKE) (opens in a new tab) node is placed in a Virtual Private Cloud (VPC) (opens in a new tab) network and subnet and receives an internal IP address from the subnet range. Resources in the same VPC can reach each other over those internal addresses when firewall rules permit, while private paths control how they reach Google services, other clusters, on-premises networks, and the internet.
VPC networking for Compute Engine provides the subnet, internal addressing, and private paths that VMs depend on for secure communication. When a VM is created, the VPC network and subnet determine its internal IP address, and traffic between VPC resources flows over internal addresses if firewall rules allow it. VMs with only internal addresses can still reach many Google APIs and services through Private Service Connect or Private Google Access, which keeps that traffic off the public internet. To limit internet exposure, organizational policies can restrict which resources receive external IP addresses, while Secure Web Proxy handles HTTP(S) outbound traffic that needs identity controls and Cloud NAT handles other outbound traffic from private VMs.
Shared VPC is the model for centralizing VPC administration when Compute Engine and GKE resources live in separate projects. A host project holds the centrally managed VPC network and subnets, while service projects attach to the host and deploy VMs or clusters into approved subnets. Administrators grant access to either all subnets in the host project or only selected subnets, so teams can either share subnets or use dedicated subnets per service project. Building the Shared VPC (opens in a new tab) environment follows an ordered setup where each step depends on the previous one:
GKE automatically enables Private Google Access on subnets where nodes are deployed, so nodes without external addresses can still reach Google-managed services from those subnets.
Cloud Next Generation Firewall (Cloud NGFW) (opens in a new tab) is the stateful, horizontally scaled firewall that is enforced in a distributed way on each VM, including GKE nodes. Best practice is to use fewer, broader rule sets because only a limited number of rules can be programmed on a VM, so one rule that allows 10 ingress TCP ports is more efficient than 10 single-port rules. Rules should follow least privilege by denying by default and allowing only needed protocols and ports, with firewall rules logging enabled for visibility and Firewall Insights for analysis. Priorities control which rule wins when rules overlap, so more specific rules must have higher priority than general rules to avoid being shadowed:
Hierarchical firewall policies enforce consistent controls at the organization and folder levels alongside VPC-level network firewall policies. A hierarchical policy permits Identity-Aware Proxy (IAP) for TCP forwarding from 35.235.240.0/20 for TCP ports 22 and 3389, which supports SSH and RDP without VM external addresses. The same approach permits Cloud Load Balancing health checks from 35.191.0.0/16 and 130.211.0.0/22 for ports 80 and 443 for most load balancers, while Network Load Balancing also requires legacy health-check sources 209.85.152.0/22 and 209.85.204.0/22 for ports 80 and 443.
GKE VPC-native networking makes Pod addresses part of the VPC through alias IP ranges, so Pod traffic is native VPC traffic rather than traffic hidden behind node addresses. Each cluster therefore depends on the VPC subnet plus additional IP space for Pods and Services, which is why planning must cover Pod density per node, growth for the cluster autoscaler, a subnet for load balancers, and sharing or reuse of addresses across clusters. Best practice is to use custom subnet mode for explicit control, use more than private RFC 1918 space when needed, and avoid overlap with addresses used on-premises or in other VPCs, regions, or projects. Careful planning prevents exhaustion and routing conflicts when clusters scale, peer, or connect to hybrid networks.
For outbound and service access, private GKE clusters rely on the same VPC mechanisms as Compute Engine. Cloud NAT lets Pods without public addresses initiate outbound internet connections, such as downloading updates or calling external APIs, without accepting inbound internet connections. Private Google Access lets the cluster reach services such as Cloud Storage or Cloud SQL without traversing the public internet, which is the key egress path for private clusters that use Google APIs. For hybrid links, traffic flows from the VPC to on-premises through Cloud VPN for encrypted tunnels or through Cloud Interconnect for dedicated high-bandwidth connections, while Multi-cluster Services enables discovery and traffic flow between multiple GKE clusters across regions or projects.
Kubernetes NetworkPolicy is the firewall for Pods that controls east-west traffic inside a GKE cluster. By default all Pods in a cluster can communicate freely, but a NetworkPolicy selects a group of Pods by label and restricts their ingress and egress by Pod labels, IP address ranges, and port numbers. When the first NetworkPolicy is created in a namespace, all traffic not explicitly allowed by policy is denied, which enforces least privilege between microservices. Enforcement is built into GKE Dataplane V2 or handled by the cluster container network interface (CNI) plugin such as Calico, while third-party custom CNIs are not officially supported by GKE.
A common pattern allows only frontend Pods to reach backend Pods on a single database port, such as allowing ingress to Pods labeled app: backend only from Pods labeled app: frontend on TCP port 6379. VPC firewall rules and NetworkPolicy together provide defense-in-depth across two different layers, because they enforce at different places and protect different resources:
| Control | Where it enforces | What it protects |
|---|---|---|
| VPC firewall rules | GKE nodes at Layer 3 or Layer 4 | Traffic to and from the VMs that host Pods |
| Kubernetes NetworkPolicy | Pods at Layer 3 or Layer 4 | Granular traffic between applications inside the cluster |
VPC rules cannot replace Pod-level isolation, and Pod policies cannot protect the node itself. Do not apply broad ingress or egress firewall rules to cluster nodes without care, because egress-deny rules on nodes can break NodePort, kubectl exec, and other cluster features.
External north-south access to GKE applications is controlled at the Kubernetes Service, Ingress, and load balancer layers before traffic reaches Pods. When a Service uses type: LoadBalancer, the loadBalancerSourceRanges field restricts which client IP ranges can reach the external load balancer. For HTTP(S) applications exposed through Ingress, Google Cloud Armor acts as a web-application firewall against DDoS and web threats, while Identity-Aware Proxy (IAP) verifies user identity for fine-grained access to endpoints. These edge controls sit outside the cluster, so traffic flows from internet clients to the load balancer policy first and only then to the Service, Pods, and nodes permitted by VPC and NetworkPolicy rules.
Exam tip: VPC firewall rules filter traffic at the GKE node level, while Kubernetes NetworkPolicy filters traffic at the Pod level; use both together and never assume a node firewall rule provides Pod-to-Pod isolation.
Serverless Connectivity and Private Access is the set of network paths that let serverless workloads reach private resources without using the public internet. In Google Cloud, Serverless VPC Access (opens in a new tab) and Direct VPC egress carry traffic from serverless environments into a Virtual Private Cloud (VPC) (opens in a new tab) network, while Private Service Connect (PSC) (opens in a new tab) exposes Google APIs and VPC-hosted services through private endpoints. Traffic flows from the serverless environment into the VPC network, and responses flow back from the VPC resource to the serverless environment.
Connecting serverless environments to a VPC network means letting Cloud Run (opens in a new tab), App Engine standard environment, and Cloud Run functions send packets to the internal IPv4 addresses of resources in a selected VPC network. Both Direct VPC egress and a Serverless VPC Access connector support this flow, and both also support sending packets onward to other networks connected to the selected VPC network. Common reasons to connect serverless to a VPC include reaching third-party software running on a Compute Engine virtual machine (VM), reaching a backend service on a Managed Instance Group without internet exposure, and reaching an on-premises database through Cloud VPN. Use Direct VPC egress when it is available because it sends traffic directly without connector management, and use a connector only when direct egress is not an option:
| Option | How traffic enters the VPC | When to choose it |
|---|---|---|
| Direct VPC egress | Serverless service sends traffic directly to the VPC network | When the serverless platform supports direct egress and no connector management is wanted |
| Serverless VPC Access connector | Serverless service sends traffic through a connector provisioned in the VPC network | When Direct VPC egress is not an option for the environment or region |
A Serverless VPC Access connector is a regional resource with its own IP range that acts as the source of serverless traffic inside the VPC network. For example, a connector assigned 10.8.0.0/28 sends every request with a source address from that range, and the connector handles sending the request and receiving the response directly with the internal address of the destination, such as 10.0.0.4. All requests and responses between the serverless environments and VPC resources travel internally, are never exposed to the internet, and can use internal DNS and internal IP addresses. The connector only carries private traffic and responses to serverless-initiated requests, so traffic from the VPC network reaches the serverless environment only when it is a response to a request that the serverless environment sent through the connector.
Requests sent to external IP addresses still travel through the internet and do not use the connector, which preserves the boundary between private VPC traffic and public traffic. When the connector sends to a resource in a different region, such as 10.1.0.2, outbound data transfer costs apply because the destination region differs from the connector region. The connector lives in the same region as the serverless workload, so region selection controls both latency and cost for cross-region flows.
Exam tip: Serverless VPC Access connects serverless outward to private VPC addresses, while Private Service Connect exposes a service or Google API inward through a private endpoint — the direction of who is exposed is opposite.
Serverless VPC Access support depends on both the serverless platform and the type of network attached to the selected VPC network. Connectors are supported in every region that supports Cloud Run, Cloud Run functions, or the App Engine standard environment, and the connector must live in the same region as the serverless workload. The following serverless environments can use Serverless VPC Access, with one exception for older runtimes and two cases that normally do not need a connector:
A connector can reach resources in the selected VPC network and in networks attached to it, which extends private serverless reach across hybrid and peered topologies. Reachable attached networks include VPC and Shared VPC (opens in a new tab) networks, legacy networks, networks connected through Cloud Interconnect, networks connected through Cloud VPN, and networks connected through VPC Network Peering. Serverless VPC Access supports TCP and UDP for private traffic, supports Internet Control Message Protocol (ICMP) only for external IP addresses, and does not support IPv6 traffic.
Private Service Connect is a producer-consumer model that makes a workload accessible across VPC networks through a single private endpoint instead of exposing an entire network. A consumer VPC network uses a private IP address to connect to a Google API or to a service published in another producer VPC network, so neither side needs external IP addresses. The same endpoint model can be extended to an on-premises network over Cloud VPN or Cloud Interconnect, letting on-premises hosts reach Google APIs or managed services by using the internal IP address of the endpoint.
The producer and consumer sides depend on different resources by layer to handle overlapping addresses and service selection. At Layer 4, the producer creates Private Service Connect subnets, also called NAT subnets, and Private Service Connect performs source Network Address Translation (NAT) with an address from those subnets before routing to the producer, which allows overlapping IP addresses between consumer and producer. At Layer 7, the consumer can create a Private Service Connect backend on an internal Application Load Balancer that selects available services with a URL map. For Google APIs, the design pairs this endpoint with Private Google Access, which is enabled at the subnet level and lets VM instances with only internal IP addresses reach supported Google services through the VPC network default internet gateway without public exposure.
Google Cloud VMware Engine (GCVE) (opens in a new tab) is a fully managed service that runs the VMware platform on dedicated bare-metal infrastructure in Google Cloud. Each deployment is a private cloud (opens in a new tab) that includes vSphere, vCenter Server, vSAN storage, VMware NSX-T for networking and security, and VMware HCX for migration. Google manages the physical hosts, platform upgrades, and underlay networking, while you manage workload virtual machines (VMs), NSX-T segments, and firewall policy, which preserves existing VMware tools and operational practices.
VMware NSX-T provides the software-defined network inside a GCVE private cloud, including overlay segments, distributed routing, microsegmentation, and firewall policy. Workload VMs receive IP addresses from NSX-T segments that you create in the private cloud, and all communication within the private cloud and toward external IP addresses is routed over Layer 3 by default. The exception is networks stretched from on-premises or from another private cloud, which preserve Layer 2 adjacency for migrated workloads that cannot be readdressed. Segment routes are summarized at the NSX-T Tier-0 gateway, and a Cloud Router associated with the hybrid connection advertises those summaries to on-premises and Virtual Private Cloud (VPC) networks with custom advertised routes.
DHCP for segments is supplied through NSX-T DHCP Relay to DHCP services in the private cloud, so segments depend on relay configuration rather than local DHCP servers. This design separates responsibilities across a clear boundary: Google operates the bare-metal hosts and edge gateways, while NSX-T controls east-west microsegmentation and north-south gateway policy inside your private cloud. The boundary keeps underlay operations with Google and overlay network and security policy with the customer.
Connectivity between GCVE and native Google Cloud services depends on two different VPC networks and a peering relationship between them. The VMware Engine tenant VPC network is a Google-managed VPC attached to every private cloud, and the customer VPC networks are the VPC networks you own. A common pattern uses an external customer VPC for public-facing load balancer and appliance interfaces and an internal customer VPC for private communication with GCVE. Traffic flows from the internal customer VPC to the tenant VPC through private services access, which uses VPC Network Peering to connect Google-managed services to your VPC.
Name resolution flows from peered VPC networks to a Cloud DNS (opens in a new tab) management zone that is auto-populated with management appliance entries, with zone bindings that let Google Cloud VMs resolve vCenter, NSX Manager, and HCX endpoints. Hybrid reach to on-premises data centers flows from the VMware Engine network through Cloud VPN or Cloud Interconnect, so the same private cloud can communicate privately with Compute Engine, Cloud Storage, Google APIs, and on-premises networks without using the internet. Setting up the base hybrid network follows an ordered dependency where peering and address planning must complete before hybrid routes are added:
nic0 in the external VPC, nic2 in the internal VPC, and optional nic1 for management.VMware HCX (opens in a new tab) is the migration service for moving applications and rebalancing workloads between on-premises data centers, other clouds, and GCVE. HCX runs as part of the private cloud alongside vCenter, NSX Manager, ESXi hosts, and vSAN, and it uses the same hybrid network path established by private services access and Cloud VPN or Cloud Interconnect. This placement lets migration traffic travel privately from the source environment to the GCVE overlay rather than over public endpoints. First the underlay and peering must carry management and vMotion traffic, then HCX stretches selected segments, then workloads move while keeping their IP and policy context.
HCX supports data-center retirement, on-demand expansion, disaster recovery, and virtual desktop use cases because it can extend Layer 2 networks and move VMs without readdressing them. Choose HCX when continuity matters, because the same networking, security, and audit policies continue to apply after the VM lands on GCVE bare metal. The dependency order is strict: the hybrid connection and peering must exist before HCX can stretch networks, and networks must be stretched before workloads can move with preserved addresses.
Centralized inspection places third-party appliances from Google Cloud Marketplace in line between the internet, on-premises networks, and GCVE segments. The appliances run on Compute Engine and provide functions that NSX-T alone does not centralize, which makes the appliance tier the policy enforcement point for traffic crossing security zones:
The architectures use Cloud Load Balancing (opens in a new tab) as the frontend and do not use the built-in NSX-T load balancers. Separate VPC networks provide security-zone segregation: public and load-balancer interfaces sit in the external VPC, while GCVE-facing interfaces sit in the internal VPC that is peered to the tenant VPC. Public Layer 4 ingress flows from the internet to a regional external passthrough Network Load Balancer in the external VPC, then to the appliances, then from nic2 through the internal VPC peering to the GCVE VM.
The appliances must perform destination network address translation (DNAT) from the forwarding-rule public IP to the VM IP, perform source network address translation (SNAT) on nic2 traffic to ensure a symmetric return path, and route GCVE-bound traffic through nic2 to the subnet gateway. For health checks to pass, the appliances must answer the forwarding-rule IPs on secondary or loopback interfaces. Different traffic goals select different frontends, even though all patterns keep inspection in the appliance tier:
| Pattern | Frontend in customer VPC | When traffic uses this path |
|---|---|---|
| Public NGFW | Regional external passthrough Network Load Balancer with unique IP and TCP/UDP port per workload | Internet clients need Layer 4 access to GCVE VMs with DNAT and SNAT inspection, while egress still uses the VMware Engine internet gateway |
| Public NGFW with protection and acceleration | Global external Application Load Balancer with Cloud Armor, Google-managed SSL certificates, and Cloud CDN | Internet clients need Layer 7 routing, URL mapping, SSL termination, L3–L7 DDoS protection, and caching across Compute Engine, Cloud Storage, and GCVE backends |
| Private inspection | Internal passthrough Network Load Balancer | Traffic flows privately between GCVE and on-premises or other clouds and must pass through NGFW and IDS/IPS before reaching segments |
| Centralized egress | Internal passthrough Network Load Balancer in front of appliances | GCVE-originated internet traffic must leave through controlled inspection points instead of the default internet gateway |
For the Layer 7 pattern, requests flow from the internet to the Application Load Balancer, then to the appliance backends, then through peering to GCVE. URL mapping can split one frontend across destinations, for example /api to Compute Engine VMs, /images to a Cloud Storage bucket, and /app through appliances to GCVE VMs.
Exam tip: Use Cloud Load Balancing, not the built-in NSX-T load balancers, as the frontend for centralized GCVE inspection, and require SNAT on appliance nic2 traffic so return traffic follows the same appliance path.
Virtual Private Cloud firewall rules enforce at the Google Kubernetes Engine nodes at Layer 3 or Layer 4 and protect traffic to and from the virtual machines that host Pods, while Kubernetes NetworkPolicy enforces at the Pods at Layer 3 or Layer 4 and controls granular traffic between applications inside the cluster. VPC rules cannot replace Pod-level isolation and Pod policies cannot protect the node itself, so both are used together for defense-in-depth across two different layers.
Direct VPC egress should be used when the serverless platform supports direct egress and no connector management is wanted because the serverless service sends traffic directly to the VPC network. A Serverless VPC Access connector should be used only when Direct VPC egress is not an option for the environment or region, in which case the serverless service sends traffic through a connector provisioned in the VPC network.
Shared VPC centralizes administration by keeping the centrally managed Virtual Private Cloud network and subnets in a host project while service projects attach to the host and deploy Compute Engine virtual machines or Google Kubernetes Engine clusters into approved subnets. Administrators grant access to either all subnets in the host project or only selected subnets, and subnets for workloads use Private Google Access so virtual machines without external addresses can reach Google services.
Centralized inspection for Google Cloud VMware Engine places third-party appliances on Compute Engine in line between the internet, on-premises networks, and NSX-T segments and uses Cloud Load Balancing, not the built-in NSX-T load balancers, as the frontend. Public and load-balancer interfaces sit in an external Virtual Private Cloud network while GCVE-facing interfaces sit in an internal network peered to the tenant VPC, and the appliances must perform destination network address translation from the forwarding-rule public IP to the virtual machine IP and source network address translation on internal-facing traffic to ensure a symmetric return path.
Your company runs containerized backend workloads on Cloud Run in the us-central1 region. These serverless applications must communicate securely with the following resources:
All traffic between Cloud Run, the internal VMs, and Google APIs must traverse the VPC network without being routed over the public internet.
How should you configure the Cloud Run networking architecture to satisfy these requirements?
Last updated