Recall & Review
beginner
What is a Kubernetes Network Policy?
A Kubernetes Network Policy is a set of rules that controls how pods communicate with each other and with other network endpoints. It acts like a firewall inside the cluster to allow or block traffic.
Click to reveal answer
beginner
Which Kubernetes resource is used to define traffic rules between pods?
The
NetworkPolicy resource is used to define rules that specify allowed inbound and outbound traffic for pods based on labels and ports.Click to reveal answer
intermediate
What does the
podSelector field do in a Network Policy?The
podSelector field selects which pods the policy applies to by matching labels. Only pods matching this selector are affected by the policy rules.Click to reveal answer
intermediate
How does a Network Policy affect traffic if no policies are applied to a pod?
If no Network Policies select a pod, then all traffic to and from that pod is allowed by default. Policies only restrict traffic when applied.
Click to reveal answer
beginner
What is the difference between
ingress and egress rules in Network Policies?Ingress rules control incoming traffic to pods, while egress rules control outgoing traffic from pods.Click to reveal answer
What does a Kubernetes Network Policy primarily control?
✗ Incorrect
Network Policies control how pods communicate by allowing or blocking network traffic.
Which field in a Network Policy specifies which pods the policy applies to?
✗ Incorrect
The podSelector field selects pods by labels to apply the policy rules.
If a pod has no Network Policies applied, what is the default behavior for its traffic?
✗ Incorrect
Without any Network Policies, pods accept all traffic by default.
What does an ingress rule in a Network Policy control?
✗ Incorrect
Ingress rules specify what incoming traffic is allowed to pods.
Which Kubernetes resource would you create to block all traffic to a pod except from a specific namespace?
✗ Incorrect
NetworkPolicy with a namespaceSelector in ingress rules can restrict traffic to pods from specific namespaces.
Explain how Kubernetes Network Policies control pod communication and why they are important.
Think of Network Policies as rules like a gatekeeper for pod traffic.
You got /4 concepts.
Describe the difference between ingress and egress rules in Network Policies with an example for each.
Ingress is like who can visit your house; egress is where you can go out.
You got /4 concepts.