0
0
Kubernetesdevops~5 mins

Network policies for security 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 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?
AAll traffic is allowed
BAll traffic is blocked
COnly ingress traffic is allowed
DOnly egress traffic is allowed
Which field in a Network Policy specifies the pods the policy applies to?
ApodSelector
BnamespaceSelector
CpolicyTypes
Dingress
How do you specify that a Network Policy should restrict outgoing traffic?
AUse the ingress field
BUse the egress field
CSet policyTypes to Ingress only
DSet podSelector to empty
What does setting policyTypes: ["Ingress"] do?
ABlocks all traffic
BRestricts only outgoing traffic
CRestricts only incoming traffic
DAllows all traffic
Which selector allows you to restrict traffic from pods in a different namespace?
ApodSelector
BpolicyTypes
CipBlock
DnamespaceSelector
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.