Can you please help me on understanding this concept?

Panidhar T:
can you please help me on understanding this concept ?

lagisetti sambasiva rao:
@Panidhar T Please go through the below . you can able to get it. https://www.youtube.com/watch?v=v7_XvCW6U48 https://github.com/ahmetb/kubernetes-network-policy-recipes

Panidhar T:
Thanks for the video in exam they were asking question as below which i couldn’t understand

Panidhar T:
in question they asked not to modify/create/delete existing network policy
Given the running pod kdsn00201-newpod edit it to use a network policy that will allow it to send and receive traffic only to and from the web and storage pods
asking to edit pod\

Hello Panidhar,
I am assuming you need to solve this using the below policy - By having multiple pod selectors referring to one pod selector -


kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: redis-allow-services
spec:
podSelector:
matchLabels:
app: bookstore
role: db
ingress:

  • from:
    • podSelector:
      matchLabels:
      app: bookstore
      role: search
    • podSelector:
      matchLabels:
      app: bookstore
      role: api

Did you get solution for this?