Prepare and test your skills

Prepare and test your skills

Manage Traffic Direction and Resource Targeting is the practice of deciding which way traffic is allowed to flow and exactly which resources that decision applies to. Kubernetes Network Policies (opens in a new tab) provide this control at the IP address or port level, which corresponds to OSI Layer 3 or Layer 4. Policies are application-centric, so they specify how a pod is allowed to communicate with other pods in the same cluster.
Controlling traffic flow between pods means using Kubernetes Network Policies to define allowed communication paths based on IP address and port. The policy allows intended pod-to-pod traffic to pass while blocking all other traffic to the protected workload. If there are no restrictions on which pods can interact within the cluster, no Kubernetes Network Policies are needed.
Isolating Cassandra and Redis pods means limiting which other pods can reach those data pods. Communication with Cassandra pods is allowed only from pods that need it for normal operation:
Other pods that do not need access, such as Ingress and Watcher pods, are blocked from communicating with Cassandra pods. The same approach secures Redis pods by limiting which pods can reach them.
Enabling and applying network policies requires a running cluster with policy enforcement turned on. The cluster must be running Apigee hybrid version 1.8 or newer, and enforcement must be enabled through the platform vendor, such as GKE, EKS with Calico, AKS, or another vendor. Packaging for these example policies with apigeectl is only supported for Apigee hybrid versions 1.11 and older.
Policies are applied to a namespace in an ordered sequence:
app=apigee to the Apigee namespace with kubectl label, replacing the namespace name if a non-default namespace is used.securing-cassandra-redis-pods overlay for the organization with kubectl apply -k.Exam tip: Use Kubernetes Network Policies only when specific pods must be isolated; clusters with no pod-to-pod restrictions do not need them.
Policy scope in Cloud Next Generation Firewall (Cloud NGFW) (opens in a new tab) determines which networks a set of firewall rules can protect. A firewall policy is a container that groups multiple firewall policy rules, and a firewall policy rule is the fundamental unit that allows, denies, or inspects traffic. The policy type sets the scope, and association activates the policy on a specific resource in the Google Cloud resource hierarchy.
Hierarchical firewall policies are policy containers for broad, consistent enforcement across many Virtual Private Cloud (VPC) networks in one or more projects. A hierarchical firewall policy is created at the organization or folder level and must be associated with an organization or a folder. Traffic rules in the associated policy then flow down to every matching VPC network in the projects under that organization or folder. Choose hierarchical firewall policies when a central security team needs to enforce the same baseline for an entire company or department.
A hierarchy from Organization to Folder to Project to VPC Network to regions, showing where hierarchical, global, regional, and Google-managed system firewall policies associate and what scope they protect.
Global network firewall policies are policy containers that protect all regions of a specific VPC network. A global network firewall policy lives in the same project as the VPC networks it protects and can be associated with one or more VPC networks in that project. Once associated, the rules in the policy apply to matched traffic in every region of each attached VPC network. Choose global network firewall policies when one VPC network needs the same rules everywhere without repeating them per region.
Regional network firewall policies are policy containers that protect a single region of a VPC network. A regional network firewall policy lives in the same project as the VPC networks it protects and is associated with a single region of one or more VPC networks in that project. Traffic in other regions of the same VPC network is not affected by that regional association. Choose regional network firewall policies when security needs differ by region or when only one region hosts sensitive workloads.
Regional system firewall policies are Google-managed policy containers for a specific region of a VPC network. Google Cloud creates a regional system firewall policy when a Google service requires rules in that region, and more than one such policy can exist for the same region. You cannot modify a rule in a regional system firewall policy except to enable or disable firewall rule logging, and you are not charged for evaluation of its rules. Google Cloud evaluates these system rules immediately after hierarchical firewall policies, so they provide required service access without replacing customer-controlled policies.
Firewall policy association is the link that turns grouped rules into enforced protection for matched traffic. The association target depends on the policy type, and a policy has no effect until the association is complete. Regular VPC networks support hierarchical, global network, regional network, and VPC firewall rules, while Remote Direct Memory Access (RDMA) networks are protected by regional network firewall policies.
| Policy type | Scope of protection | Association target |
|---|---|---|
| Hierarchical firewall policies | Many VPC networks in one or more projects | Organization or folder |
| Global network firewall policies | All regions of attached VPC networks | One or more VPC networks in the same project |
| Regional network firewall policies | Single region of attached VPC networks | Single region of one or more VPC networks in the same project |
The hierarchy creates consistent coverage because a higher-level association reaches everything below it, while a network-level association stays inside its project and region boundary. When you create a hierarchical or network firewall policy, Google Cloud also adds predefined rules to the policy.
Exam tip: Associate hierarchical firewall policies with an organization or folder, and associate global or regional network firewall policies with VPC networks in the same project as the policy.
Define Rule Attributes and Traffic Filtering is the practice of writing precise Cloud Next Generation Firewall (Cloud NGFW) (opens in a new tab) rules that decide which packets can move within and across Virtual Private Cloud (VPC) networks. In Cloud NGFW, a firewall policy rule (opens in a new tab) is the fundamental unit of security configuration that defines match criteria and an action to allow, deny, or inspect traffic. A firewall policy is the container that groups multiple rules so they can be updated together and applied to the right resources.
Direction specifies whether a firewall policy rule controls inbound traffic or outbound traffic from the perspective of the target resource. Every firewall policy rule applies to either ingress or egress, never both at the same time. Ingress rules protect targets such as virtual machine (VM) network interfaces and managed Envoy proxies, while egress rules control what those targets can send outward.
| Rule direction | Traffic flow | Source requirement | Destination requirement |
|---|---|---|---|
| Ingress | Inbound packets arriving at the target from a source | Mandatory | Optional |
| Egress | Outbound packets sent from the target to a destination | Optional | Mandatory |
An ingress rule with a deny action blocks incoming connections to its targets, while an egress rule with an allow action permits a VM instance to send traffic to the listed destinations. If a higher priority rule allows traffic, the firewall permits it and ignores lower priority deny rules for that same traffic, and a high priority deny blocks egress even when a lower priority rule would allow it.
Target settings and priority determine which resources receive a firewall policy rule and in what order the rule is evaluated. Target type identifies the kind of resource the rule protects, which is VM instances by default or managed Envoy proxies used by internal Application Load Balancers and internal proxy Network Load Balancers. Target narrows the rule further to specific instances or proxies so one policy can protect different workloads differently. Priority is a unique integer within a policy where a lower number means higher priority and is evaluated first.
Source and destination parameters identify where traffic comes from and where traffic is allowed to go. Source describes the sender of the packet, such as IP addresses that are sending inbound connections to a target. Destination describes the receiver of the packet, such as IP addresses that a VM is trying to reach with outbound traffic. Because source is mandatory for ingress rules and destination is mandatory for egress rules, an ingress rule always names who can connect in and an egress rule always names where connections can go out.
Protocols, ports, and action define what kind of traffic matches a firewall policy rule and what Cloud NGFW does when a packet matches. Protocols and destination ports are match conditions for a network packet, so a rule can limit traffic to a specific communication protocol and to specific destination ports. Action is the decision Cloud NGFW takes when those criteria match:
When a packet arrives, Cloud NGFW compares it against the criteria of rules in priority order, and the action of the first matching rule controls whether that connection proceeds.
Stateful filtering is how Cloud NGFW regulates communication at the network layer without re-checking every packet from scratch. The firewall inspects traffic at Layer 3 and Layer 4 of the OSI model and remembers the state of active connections. Once a connection is allowed by a matching rule, return packets for that connection are tracked in the connection tracking table. This stateful behavior protects workloads from external threats from the internet and internal threats within the network while allowing legitimate two-way communication.
Exam tip: Source is mandatory for ingress and optional for egress, while destination is mandatory for egress and optional for ingress; a lower priority number means the rule is evaluated first.
Hierarchical firewall policies protect many Virtual Private Cloud (VPC) networks through association with an organization or folder, while global network firewall policies protect all regions of attached VPC networks and regional network firewall policies protect a single region of attached VPC networks. Hierarchical firewall policies are created at the organization or folder level and their rules flow down to every matching VPC network in projects under that organization or folder, whereas global and regional network firewall policies live in the same project as the VPC networks they protect and associate with those VPC networks.
Source is mandatory for ingress rules and optional for egress rules, while destination is mandatory for egress rules and optional for ingress rules. Every firewall policy rule applies to either ingress or egress, never both at the same time. Ingress rules control inbound packets arriving at targets such as virtual machine (VM) network interfaces and managed Envoy proxies, while egress rules control outbound packets those targets send outward.
The action of the first matching rule in priority order controls the connection, where priority is a unique integer within a policy and a lower number means higher priority and is evaluated first. If a higher priority rule allows traffic, the firewall permits it and ignores lower priority deny rules for that same traffic, and a high priority deny blocks egress even when a lower priority rule would allow it.
An organization is deploying a fleet of web servers on Compute Engine instances inside a Virtual Private Cloud (VPC) network. The web servers must accept incoming public web traffic on TCP port 80.
All existing lower-priority default rules blocking unapproved traffic must remain intact, and the new rule must apply strictly to inbound requests.
Which combination of firewall rule attributes should the administrator configure to allow this traffic?
Last updated