Recall & Review
beginner
What is a Kubernetes Network Policy?
A Kubernetes Network Policy is a set of rules that control how pods communicate with each other and with other network endpoints. It helps secure the cluster by restricting traffic.
Click to reveal answer
beginner
Which Kubernetes resource defines network policies?
The resource is called
NetworkPolicy. It is a Kubernetes API object used to specify how groups of pods are allowed to communicate with each other and other network endpoints.Click to reveal answer
intermediate
What does the
podSelector field do in a Network Policy?The
podSelector field selects the pods to which the network policy applies. Only the selected pods will have the traffic rules enforced.Click to reveal answer
intermediate
How do you allow incoming traffic only from pods in the same namespace using a Network Policy?
You create an ingress rule with
from specifying podSelector matching the pods in the same namespace. This restricts incoming traffic to only those pods.Click to reveal answer
beginner
What happens if no Network Policy selects a pod?
If no Network Policy selects a pod, then by default all traffic is allowed to and from that pod. Network Policies only restrict traffic for selected pods.
Click to reveal answer
What is the default behavior for pod traffic if no Network Policy is applied?
✗ Incorrect
By default, Kubernetes allows all traffic to and from pods if no Network Policy selects them.
Which field in a Network Policy specifies the pods the policy applies to?
✗ Incorrect
The podSelector field selects the pods that the Network Policy will apply to.
How do you specify that a Network Policy should restrict outgoing traffic?
✗ Incorrect
The egress field defines rules for outgoing traffic from selected pods.
What does setting
policyTypes: ["Ingress"] do?✗ Incorrect
Setting policyTypes to Ingress means the policy controls only incoming traffic.
Which selector allows you to restrict traffic from pods in a different namespace?
✗ Incorrect
The namespaceSelector selects pods based on their namespace, allowing cross-namespace traffic control.
Explain how Kubernetes Network Policies help secure pod communication.
Think about controlling who can talk to whom inside the cluster.
You got /4 concepts.
Describe the difference between ingress and egress rules in a Network Policy.
Consider traffic direction relative to the pod.
You got /3 concepts.