0
0
Kubernetesdevops~5 mins

Network policies for traffic control in Kubernetes - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
ACPU usage of pods
BNetwork traffic between pods
CStorage allocation for pods
DPod scheduling on nodes
Which field in a Network Policy specifies which pods the policy applies to?
ApodSelector
BnamespaceSelector
CpolicyTypes
Dmetadata
If a pod has no Network Policies applied, what is the default behavior for its traffic?
AOnly ingress traffic is allowed
BAll traffic is blocked
CAll traffic is allowed
DOnly egress traffic is allowed
What does an ingress rule in a Network Policy control?
ANode network settings
BOutgoing traffic from pods
CPod resource limits
DIncoming traffic to pods
Which Kubernetes resource would you create to block all traffic to a pod except from a specific namespace?
ANetworkPolicy with namespaceSelector in ingress
BPodSecurityPolicy
CConfigMap
DServiceAccount
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.