Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Developer practice bank has an additional 608 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
You are deploying a three-tier microservices application (frontend, api, and database) into a single namespace on a Google Kubernetes Engine (GKE) Autopilot cluster. To enforce a zero-trust network model, you apply a default-deny NetworkPolicy blocking all ingress and egress traffic for every Pod in the namespace.
You must meet the following communication requirements:
frontend Pods reach the api Service using its Kubernetes DNS name on TCP port 8080.api Pods reach the database Service using its Kubernetes DNS name on TCP port 5432.Which configuration should you implement?
NetworkPolicy manifests with podSelector rules allowing Ingress to api (from frontend on TCP port 8080) and database (from api on TCP port 5432), and Egress from frontend and api strictly limited to those respective target Pod labels and application ports.This configuration uses valid Kubernetes label selectors (podSelector and matchLabels) to permit application-level Ingress and Egress traffic between tiers on TCP ports 8080 and 5432, without adding an explicit rule for DNS traffic.
Egress policy selects all Pods in the namespace, every outbound packet not explicitly matched by an allow rule is dropped—including DNS queries.frontend attempts to look up the api Service hostname, or api attempts to resolve database, DNS requests on port 53 time out, preventing the applications from connecting to one another.NetworkPolicy specifying Egress applies to a Pod, outbound connectivity operates on an explicit allow-list basis.The default-deny NetworkPolicy only restricted Ingress traffic (leaving all Egress open by default), or the microservices connected directly via static IP addresses without performing any DNS lookups.
Forgetting to permit TCP and UDP port 53 in egress rules is one of the most common pitfalls when implementing zero-trust NetworkPolicy baselines in GKE.
NetworkPolicy manifests using ipBlock.cidr rules in the ingress and egress sections to specify the ClusterIP addresses of the api and database Services on TCP ports 8080 and 5432, along with Egress to kube-dns on port 53.ipBlock.cidr Rules DoThe ipBlock field in a Kubernetes NetworkPolicy specifies IPv4 or IPv6 CIDR ranges (with optional except exclusions) to control traffic between Pods and IP addresses outside the cluster, such as external APIs or on-premises networks.
ClusterIPs) inside the ipBlock.cidr field of a NetworkPolicy manifest; internal workloads must be referenced by labels.NetworkPolicy enforcement occurs at the Pod endpoint level after Service virtual IP translation, and ClusterIP addresses do not represent the source identity of calling Pods.ClusterIP values.podSelector labels cannot distinguish between different application tiers sharing the same subnet range.The workload needed to allow egress traffic to a fixed external IP range outside the Kubernetes cluster (such as an external legacy database in a peered VPC or on-premises data center) rather than internal cluster Services.
In Kubernetes zero-trust networking, labels—not IP addresses—serve as the foundational selector for Pod-to-Pod communication rules.
NetworkPolicy manifests with podSelector rules allowing Ingress to api (from frontend on TCP port 8080) and database (from api on TCP port 5432), and Egress from frontend and api to those respective target Pod labels and ports, plus Egress to port 53 over both TCP and UDP.A Kubernetes NetworkPolicy is a namespace-scoped resource that acts as a Layer 3 and Layer 4 firewall for Pods. In GKE Autopilot clusters, GKE Dataplane V2 enforces these policies natively using eBPF programs. In a zero-trust architecture starting from a default-deny baseline, policies are additive, meaning only explicitly permitted ingress and egress paths are allowed.
Ingress rules on api and database using podSelector labels ensures only frontend can reach api on TCP port 8080, and only api can reach database on TCP port 5432.Egress rules on frontend and api authorize only the exact downstream Pod labels and ports needed.api and database Service hostnames while keeping all other outbound connections blocked.frontend Pod does not allow lateral movement directly to database Pods.Unlike approaches that omit DNS egress, hardcode ClusterIP addresses in ipBlock rules, or rely on VPC firewalls, this configuration strictly follows Kubernetes zero-trust principles while keeping Service-based DNS resolution functional.
frontend, api, and database into separate Kubernetes namespaces instead of using additional NetworkPolicy resources, and configure VPC firewall rules targeting node tags to restrict traffic on TCP ports 8080 and 5432.Kubernetes namespaces logically partition cluster objects for naming scope and RBAC permissions, while Google Cloud VPC firewall rules enforce Layer 3 and Layer 4 filtering at the Compute Engine VM (worker node) level using network tags or service accounts.
NetworkPolicy.frontend Pods to reach api Pods while blocking other Pods running on the same cluster nodes.8080 and 5432, an active default-deny NetworkPolicy still blocks all Pod traffic until explicit NetworkPolicy allow rules are added.NetworkPolicy resources are required for true Pod-level zero-trust segmentation.The objective were to separate team administrative RBAC boundaries (namespaces) and filter north-south traffic entering or leaving GKE worker node VMs across the VPC perimeter (VPC firewall rules).
Effective GKE defense-in-depth combines VPC firewall rules for node perimeter protection with Kubernetes NetworkPolicy resources for granular Pod-to-Pod isolation.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated