Prepare and test your skills
Prepare and test your skills
Modern service connectivity and container networking connect Kubernetes Pods and shared services without exposing entire networks. Google Kubernetes Engine (GKE) (opens in a new tab) implements the Kubernetes networking model directly on Virtual Private Cloud (VPC) (opens in a new tab) infrastructure, while Private Service Connect (opens in a new tab) exposes individual services as private endpoints across VPC networks, projects, and organizations. Traffic flows from clients to stable service endpoints, then to backend Pods or producer services through VPC routing or private endpoints.
The Kubernetes networking model defines how Pods, Services, and clients communicate by focusing on Pod-to-Pod and Service-based traffic rather than host networking. Every Pod receives its own unique IP address shared by its containers, and all Pods can reach each other directly on a flat network without Network Address Translation (NAT). Because Pods are short-lived and get new addresses when re-created, a Service groups Pods behind a stable virtual IP address and DNS name.
Key principles of the Kubernetes networking model include:
my-service.my-namespace.svc.cluster.local for service lookup.Traffic flows from the client to the Service virtual IP, then the node-level data plane forwards the packet to one selected backend Pod. In traditional clusters this interception is programmed by kube-proxy using iptables, while modern clusters that use GKE Dataplane V2 replace iptables with eBPF for improved performance and observability.
VPC-native GKE networking makes Pod IP addresses directly routable inside the VPC by using alias IP ranges. In a VPC-native cluster, Pod IP addresses are alias IP addresses drawn from VPC subnet secondary ranges, so packets travel through normal VPC routing without NAT between nodes. This design simplifies cross-node communication and preserves source addresses for firewall and flow analysis.
GKE networking acts as the bridge between the Kubernetes model and Google Cloud infrastructure. The Container Network Interface (CNI) plugin on each node allocates Pod IPs and connects Pods to the node network, while the GKE control plane interacts with Google Cloud to configure VPC routes for Pod ranges, manage firewall rules, and provision load balancers from Kubernetes objects. Every GKE cluster runs inside a VPC, so nodes, Pods, and Services all consume address space planned with CIDR blocks such as 10.10.0.0/16. Careful CIDR planning prevents address exhaustion as clusters and namespaces scale.
Exposing container services in GKE combines stable in-cluster discovery with Google Cloud load balancing for external and internal clients. Inside the cluster, applications connect to the Service ClusterIP and DNS name, and the data plane load-balances each connection across healthy Pods at the source. For traffic entering the cluster, Ingress controllers and load balancers commonly use HTTP and HTTPS at the application layer to route requests to the correct Service.
Cloud Load Balancing (opens in a new tab) serves as the front door that routes traffic to services for speed, efficiency, and global availability across internal, external, Layer 4, and Layer 7 use cases. Cloud DNS translates domain names to IP addresses using public zones visible to the internet and private managed zones visible only from selected VPC networks. Service Directory provides a central inventory where services and endpoints can be published, discovered, and connected through HTTP and gRPC APIs or Cloud DNS, with integrations for Private Service Connect, GKE, and Cloud Load Balancing.
Private Service Connect creates service abstractions that make workloads accessible across VPC networks through a single private endpoint. A consumer VPC uses a private IP address to connect to a Google API or to a managed service hosted in a producer VPC, and traffic flows from the consumer endpoint to the producer service without exposing the entire producer network. This producer-consumer model lets administrators reason about which services are shared rather than which subnets or VPCs are peered, and it supports first-party services and third-party SaaS.
Private Service Connect supports consumption at Layer 4 and Layer 7 with different producer controls. At Layer 4, the producer creates one or more Private Service Connect subnets, also called NAT subnets, and Private Service Connect performs source NAT using an IP address selected from those subnets to route requests to the producer. This NAT step allows overlapping IP addresses between consumer and producer VPC networks. At Layer 7, the producer creates a Private Service Connect backend using an internal Application Load Balancer, which selects available services with a URL map. Endpoints can also be extended to an on-premises network to reach Google APIs or managed services in another VPC network over private connectivity.
Private services access is a private connection between a consumer VPC network and a network owned by Google or a third-party service producer. Private services access uses VPC Network Peering to establish connectivity, which requires the producer and consumer VPC networks to be peered with each other. By contrast, Private Service Connect exposes only the selected service through an endpoint and does not require full network peering.
The choice depends on how much of the network should be visible and whether addresses overlap:
| Option | Connectivity model | IP address requirement |
|---|---|---|
| Private Service Connect | Consumer endpoint connects to a producer service in a client-server model | Allows overlapping consumer and producer ranges because producer-side source NAT uses NAT subnets |
| Private services access | Private connection between consumer VPC and producer network established with peering | Requires producer and consumer networks to be peered |
| VPC Network Peering | Direct internal communication between two VPC networks inside Google's network | Requires peered networks to have non-overlapping IP addresses |
Exam tip: Choose Private Service Connect when networks have overlapping IP addresses or when only a specific service should be visible; peering-based access requires compatible non-overlapping ranges and exposes broader network connectivity.
Traffic management and security perimeters are the combined controls that decide where application traffic flows and where it is inspected and blocked. Cloud Load Balancing (opens in a new tab) distributes traffic across healthy backends globally or regionally, while Cloud Next Generation Firewall (Cloud NGFW) (opens in a new tab) and Google Cloud Armor (opens in a new tab) enforce boundaries around workloads, VPCs, and hybrid connections. Together they let distributed applications stay available, keep latency low, and isolate environments without inspecting every flow in one central choke point.
Workload security and perimeter security are two distinct surfaces in Cross-Cloud Network design for distributed applications. Workload security controls communication between workloads across and within VPCs, using enforcement points close to the workloads. Perimeter security is required at every network boundary between organizations or domains, including communications across VPCs, across hybrid connections to on-premises or other clouds, and to the internet.
Traffic that crosses a domain boundary must pass stateful inspection, so flow symmetry at the boundary is required. The ability to insert third-party network virtual appliances (NVAs) inside Google Cloud is critical for perimeter security across hybrid connections. In a hub-and-spoke design, a transit VPC lands external connections from Cloud Interconnect or Cloud VPN, and multi-NIC NVAs pass traffic between the routing VPC network and the transit VPC network and between workload VPC networks.
Hierarchical firewall policies are organization- or folder-level firewall policies that enforce a consistent, mandatory posture across many projects. A hierarchical firewall policy assigned to the organization or to individual folders cannot be overridden by a lower-level rule in the resource hierarchy. Rules can use a goto_next action to delegate evaluation to lower-level global or regional network firewall policies, which lets central administrators control baselines while teams manage their own VPC rules.
Common uses include organization-wide bastion host access, permitting centralized probing or health-check systems, and enforcing a virtual network boundary across an organization or group of projects. Global network firewall policies define rules for all regions of a VPC network, while regional network firewall policies define rules for a single region. For VM-level micro-segmentation, Identity and Access Management (IAM)-governed tags apply rules based on workload identity rather than IP address, and the rules work across VPC Network Peering and apply wherever the workload is deployed.
Cloud Next Generation Firewall provides stateful, horizontally scalable filtering applied per VM instance, so micro-segmentation does not degrade workload performance. Advanced inspection builds on that base with peer capabilities:
Exam tip: A lower-level firewall rule cannot override a higher-level hierarchical rule; central teams enforce the mandate at the top and use goto_next when they intend to delegate to lower policies.
Load balancing strategies in Google Cloud divide by traffic scope, with global load balancers for multi-region distribution and regional and internal load balancers for contained or tier-to-tier traffic. A global external Application Load Balancer is a proxy-based Layer 7 load balancer that distributes HTTP and HTTPS traffic to backends in multiple regions, such as Managed Instance Groups (MIGs) in two regions, and supports traffic splitting for version management. A regional load balancer keeps backends in a single region and remains resilient to zone outages, while an internal load balancer provides reliable communication between tiers, such as between the web and application tiers of a 3-tier stack.
| Load balancer scope | Traffic boundary | Choose when |
|---|---|---|
| Global external Application Load Balancer | Internet users in many regions to backends in many regions | The application is distributed across regions and needs nearest-region distribution and global failover |
| Regional load balancer | Users or clients to backends in one region | Backends live in a single region and global features, cost, or geographic control over TLS termination favor containment |
| Internal load balancer | Tier-to-tier traffic inside the VPC, such as web tier to app tier | Traffic must stay private between application tiers with load distribution and health checking |
Health determines where traffic actually flows. Load-balancing health checks route application traffic only to responsive backends, even when virtual machines (VMs) report a RUNNING state but the application software has crashed. If backends are MIGs, an additional autohealing health check proactively deletes unavailable VMs and creates new ones. For internet-facing applications with backends in more than one region, Premium Tier of Network Service Tiers enters the Google network at the point of presence (PoP) closest to the sender and exits at the PoP closest to the destination, reducing hops between users and resources.
A programmable global front end is an internet-facing entry point that combines the global external Application Load Balancer with Cloud CDN and Google Cloud Armor security policies. Protection against volumetric distributed denial-of-service (DDoS) attacks is enabled by default, while Cloud Armor provides Layer 7 filtering that scrubs incoming requests for common web attacks before they reach backend services. Cloud CDN acts as a cache at edge PoPs, so repeated content is served near users without reaching origins.
A user request flows from the internet to the backend through an ordered sequence:
Private perimeters use a different boundary that avoids broad VPC peering. With Private Service Connect (opens in a new tab), each team keeps its own VPC with its own IP space, firewalls, and routing, and exposes only defined services. Traffic flows from a client VM to a Private Service Connect endpoint in the consumer VPC, then to a service attachment in the producer VPC, then through Cloud Load Balancing to the workload. The endpoint can use global access to reach a service attachment in another region, and an internal Application Load Balancer with a hybrid network endpoint group can balance to on-premises endpoints reached through a transit VPC and Cloud Interconnect. Avoid this model when workloads need many changing ports, protocols other than TCP or UDP, or Layer 7 inspection between workloads, and choose a hub-and-spoke with centralized appliances when that inspection is mandatory.
Virtual Private Cloud (VPC) (opens in a new tab) architecture for the enterprise organizes networks, projects, and external connections to balance central control with team autonomy. A common pattern uses one or more transit or hub VPC networks that land Cloud Interconnect or Cloud VPN connections and then share that connectivity with application VPC networks that host workloads. Teams choose between Shared VPC (opens in a new tab) for centralized multi-project sharing, VPC Network Peering (opens in a new tab) for direct low-latency links between independent VPC networks, and Private Service Connect (PSC) (opens in a new tab) for isolated consumer-producer access through defined endpoints.
Shared VPC is a VPC network owned by a host project and shared with attached service projects so many teams can use common subnets without owning the network. The host project controls the VPC network, subnets, and central firewall rules, while service projects deploy virtual machines and services into the shared subnets under least-privilege permissions. Two project structures divide ownership and billing differently: a consolidated infrastructure host project manages all VPC networks and all networking charges are billed to that host, while segmented host projects give each application group its own host and VPC networks so infrastructure charges stay with the infrastructure host and data-transfer charges go to each application host.
Use a Shared VPC network for each environment when central control and scale matter most:
Avoid directly peering large separated environments to each other, because peering large environments increases the risk of accidentally mixing data and hitting peering quotas. When isolated environments must exchange data, use controlled channels on-premises or Google Cloud services such as Cloud Storage or Pub/Sub. Follow deployment hygiene by using custom mode VPC networks and deleting the default network, limiting external access with Cloud NAT and Cloud Load Balancing, and enforcing consistent rules with hierarchical firewall policies.
VPC Network Peering is a bilateral connection that lets two independent VPC networks exchange private traffic over Google's backbone with low latency and no public IP addresses. Peering is configured from both VPC networks, and once established, resources in one VPC network can reach resources in the peered VPC network directly while each team keeps its own firewall rules, routing tables, and IP administration. Firewall control still works across the boundary through hierarchical firewall policies and Identity and Access Management-governed tags, which apply policy by workload identity and work across peering for micro-segmentation.
VPC Network Peering is non-transitive, which means the peering relationship does not forward beyond its two endpoints. Traffic flows from spoke VPC network A to hub VPC network H, but it cannot continue from hub VPC network H to spoke VPC network B unless a separate peering or transitive mechanism connects them. Scale is bounded by the limit on peering connections from a single VPC network and by peering-group limits such as the maximum number of forwarding rules for internal passthrough Network Load Balancer. When spoke count must grow beyond those limits, Cloud VPN can replace peering to increase spokes and, with custom advertised routes, provide transitivity, but each Cloud VPN tunnel adds a per-tunnel bandwidth limit plus extra cost and complexity.
Hub-and-spoke designs using peering place a hub VPC network at the center and connect each workload spoke VPC network to the hub with VPC Network Peering. The hub VPC network terminates Cloud Interconnect with separate VLAN attachments for on-premises locations, and the spoke VPC networks inherit shared on-premises reachability without gaining spoke-to-spoke reachability. By design, traffic from one spoke network cannot reach another spoke network, although selected workloads can be linked later with direct spoke-to-spoke peering or with shared services such as Cloud Storage or Pub/Sub.
The variant without appliances gives teams autonomy and shared hybrid access without inspection between workloads. Traffic flows from a spoke VPC network to the hub VPC network over peering and then from the hub VPC network to on-premises over Cloud Interconnect, while each spoke team manages its own firewalls and routes. Choose this hub-and-spoke without appliances when workloads must not communicate over internal IP addresses but must share on-premises connectivity, and avoid it when Layer 7 inspection between workloads, central routing control, or on-premises access to managed services behind a second peering is required.
The variant with centralized appliances routes all inter-workload, on-premises, and internet traffic through inspection virtual machines in the hub. Traffic flows from a spoke VPC network to an internal passthrough Network Load Balancer in the hub VPC network, then from the load balancer to appliance virtual machines in a managed instance group, then from the appliances to the destination spoke, transit, or on-premises network using static routes that use the load balancer as the next hop. The design uses symmetric hashing at the load balancer so source network address translation is not required, and appliances must sit in the same region as the workloads they inspect to keep latency low. Choose this hub-and-spoke with appliances when Layer 7 inspection or a mandated appliance vendor applies to traffic between workloads, and avoid it when most workloads need no Layer 7 inspection or when workloads must remain fully isolated from each other.
Exam tip: VPC Network Peering is non-transitive, so peered spokes stay isolated from each other unless you add direct spoke-to-spoke peering or replace peering with a transitive path such as Cloud VPN with custom advertised routes or Network Connectivity Center (NCC).
Enterprise connectivity designs differ by how much control is centralized and how VPC networks reach each other. Shared VPC centralizes the network in a host project, hub-and-spoke shares hybrid access through peering to a central hub, and the consumer-producer model isolates each VPC and shares only defined services. The right choice balances team autonomy, inspection needs, and IP management.
| Design | How sharing works | Peering role | Choose when |
|---|---|---|---|
| Shared VPC per environment | Host project owns the network; service projects share subnets | No peering between environments by design | Central firewall, routing, and IP management are required |
| Hub-and-spoke with appliances | Hub hosts inspection appliances; spokes host workloads | Hub-to-spoke peering carries traffic to the inspection load balancer | Layer 7 inspection between workloads is required |
| Hub-and-spoke without appliances | Hub hosts Interconnect; spokes host workloads | Hub-to-spoke peering shares on-premises access while blocking spoke-to-spoke traffic | Team autonomy with shared hybrid access and no inter-workload inspection is required |
| Consumer-producer with PSC | Each team owns its VPC network and publishes services | No peering; client VPC networks reach producer VPC networks through PSC endpoints attached to service attachments fronted by Cloud Load Balancing | Teams must manage their own IP space, firewalls, and routes and communicate only through defined TCP or UDP endpoints |
The table shows a clear tradeoff between isolation and inspection. Shared VPC and hub-and-spoke without appliances favor central efficiency or team autonomy with simple private connectivity, while hub-and-spoke with appliances adds inspection at the cost of appliance operations and regional placement constraints. The PSC model maximizes independence because a client virtual machine sends traffic to a PSC endpoint in its own VPC network and the endpoint forwards that traffic to a service attachment in the producer VPC network, with global access allowing endpoint and attachment to sit in different regions and with a transit VPC network plus internal Application Load Balancer and hybrid endpoint groups extending the same pattern to on-premises.
Private Service Connect (PSC) exposes only a selected service through a private endpoint in the consumer Virtual Private Cloud (VPC) network without full network peering, while Virtual Private Cloud (VPC) Network Peering provides direct internal communication between two independent Virtual Private Cloud (VPC) networks. Private Service Connect (PSC) allows overlapping consumer and producer IP ranges because producer-side source Network Address Translation (NAT) uses NAT subnets, whereas Virtual Private Cloud (VPC) Network Peering requires non-overlapping IP addresses and is non-transitive so traffic cannot flow from one spoke to another through a hub without an additional path.
Virtual Private Cloud (VPC)-native Google Kubernetes Engine (GKE) networking uses alias IP ranges from Virtual Private Cloud (VPC) subnet secondary ranges so Pod IP addresses are directly routable in the Virtual Private Cloud (VPC) without Network Address Translation (NAT) between nodes. Every Pod receives its own unique IP address and all Pods communicate directly on a flat network, while a Service groups Pods behind a stable virtual IP address and DNS name to hide Pod churn.
A global external Application Load Balancer should be used when an application is distributed across regions and needs nearest-region distribution and global failover for HTTP and HTTPS traffic to backends in multiple regions. A regional load balancer should be used when backends live in a single region, and an internal load balancer should be used when traffic must stay private between application tiers such as web tier to app tier with load distribution and health checking.
An enterprise designs a multi-VPC architecture on Google Cloud featuring a central hub VPC network connected to multiple independent spoke VPC networks using VPC Network Peering. The central hub hosts shared security and management tools and provides the sole connection to the corporate on-premises data center.
Security policies require workloads in Spoke-A to communicate with workloads in Spoke-B, while ensuring all inter-spoke traffic is inspected centrally within the hub network. Direct VPC peering connections between spokes are prohibited.
Which network design should you implement to enable inter-spoke communication?
Last updated