Try each one before opening the answer. Every option is explained, with the CNCF documentation page that proves it.
Question 1 · choose 1
Pods in namespace shop are under a default-deny egress policy. To let them reach the orders database, the team adds an egress rule with ipBlock 10.96.40.12/32, the ClusterIP of the orders Service, on port 5432. The client connects to that address directly, and the connections still fail. What does the NetworkPolicy documentation point to?
AWiden the ipBlock to the cluster's whole Service CIDR
BUse a podSelector for the database Pods instead of the Service address
CAdd endPort: 5432 to the rule so that the allowed port range is explicit
DAdd an ingress rule in shop that allows the database's reply packets
Show the answer and why
AWiden the ipBlock to the cluster's whole Service CIDR
Incorrect
The problem is not the range: traffic to any Service IP may be rewritten before it is matched, so an ipBlock of Service addresses is unreliable at any size.
BUse a podSelector for the database Pods instead of the Service address
Correct
Connections to Service IPs can be rewritten to backend addresses, and it is not defined whether that happens before or after policy processing; selecting the backend Pods by label avoids the problem.
CAdd endPort: 5432 to the rule so that the allowed port range is explicit
Incorrect
endPort only extends a single port into a range; it does not affect how the destination address is matched.
DAdd an ingress rule in shop that allows the database's reply packets
Incorrect
Reply traffic for an allowed connection is implicitly allowed; no extra rule is needed for responses.
Rewriting of Service or load balancer addresses may happen before or after NetworkPolicy processing, so a rule that names a Service's ClusterIP may never match the connection. To allow traffic to in-cluster backends, select the backend Pods by label.
After a default-deny ingress policy is applied in a namespace, the HTTP liveness probes of its Pods keep succeeding. The security team asks why the policy does not block them. What is the reason?
ATraffic from the Pod's own node is always allowed, whatever the policies say
BProbes run inside the container, so they never cross the Pod network
CPolicies affect only new connections, and probes reuse one opened before the policy
DProbes use the Pod's loopback address, which policies never filter
Show the answer and why
ATraffic from the Pod's own node is always allowed, whatever the policies say
Correct
The NetworkPolicy documentation states that traffic to and from the node where a Pod is running is always allowed, and Pods cannot block access from their resident node.
BProbes run inside the container, so they never cross the Pod network
Incorrect
HTTP probes are sent by the kubelet on the node to the Pod; they reach it as traffic from the node, which policy cannot block.
CPolicies affect only new connections, and probes reuse one opened before the policy
Incorrect
Each probe is a new request; the documentation notes only that the effect on existing connections is implementation-defined.
DProbes use the Pod's loopback address, which policies never filter
Incorrect
Pods cannot block localhost traffic, but kubelet probes are not loopback traffic: they come from the node to the Pod's address.
NetworkPolicy cannot block traffic between a Pod and its own node: the documentation lists this both as an exception for IP blocks and as something policies cannot do. Kubelet probes come from the node, so they keep working under a default-deny ingress policy.
A namespace has no NetworkPolicies at all, and the cluster's network plugin supports them. Which traffic is allowed to and from the Pods in that namespace?
AOnly traffic from Pods in the same namespace
BAll ingress and egress traffic
CNo traffic, until a policy allows it
DOnly egress traffic
Show the answer and why
AOnly traffic from Pods in the same namespace
Incorrect
Without a selecting policy the Pod is not isolated at all; same-namespace limits need a policy.
BAll ingress and egress traffic
Correct
The NetworkPolicy documentation says that if no policies exist in a namespace, all ingress and egress traffic is allowed to and from its Pods.
CNo traffic, until a policy allows it
Incorrect
Pods are non-isolated by default; isolation starts when a policy selects them.
DOnly egress traffic
Incorrect
Both directions are open while no policy selects the Pod.
Pods are non-isolated by default. Only when a NetworkPolicy selects a Pod does it become isolated for the policy types listed, and then only allowed connections pass.
A NetworkPolicy must allow traffic from the namespace named monitoring, which has no custom labels. Which label can its namespaceSelector match?
Akubernetes.io/metadata.name: monitoring
Bname: monitoring
Cmetadata.namespace: monitoring
Dapp.kubernetes.io/name: monitoring
Show the answer and why
Akubernetes.io/metadata.name: monitoring
Correct
The control plane sets the immutable label kubernetes.io/metadata.name on every namespace, with the namespace's name as its value.
Bname: monitoring
Incorrect
No name label is added automatically; it would have to be created.
Cmetadata.namespace: monitoring
Incorrect
That is a field path, not a label on the namespace.
Dapp.kubernetes.io/name: monitoring
Incorrect
This is a recommended label for applications; it is not set on namespaces automatically.
NetworkPolicy selects namespaces by label. Because Kubernetes adds kubernetes.io/metadata.name to every namespace, a policy can target a namespace by name without adding labels first.