naveen B:
Hi all, I have a question on Network policies:
I have new pod np
added to K8s cluster in namespace n
and I have to allow to/fro communication from existing pods, pod a
and pod b
in the same namespace.
Is there a way I can edit np to use existing network policy to allow communication ? how can we edit pod to use network policy here ?
Mohamed Ettaki Talbi:
use should use np from/to labels in your pod-a pod-b
Vitor Jr.:
You probably would have to label those pods and then kubectl edit *networkpolicy...*
and use podSelector to match those new labels and finally configuring the rules you need (ingress/egress/port/etc,)
naveen B:
@Vitor Jr.: Is there any way we can do without modifying existing netpols, I have requirement where I can’t modify existing netpols I just have to use existing netpols
Vitor Jr.:
Well, since the default behavior for np is to deny, and you don’t want to edit those you have, you could create a new np to achieve this
Vitor Jr.:
We have a question just like this in the lightning lab
Mohamed Ettaki Talbi:
yeah, you modify pod labels to match NP
naveen B:
Will go over the questions one more time, I joined this channel bit late and you guys are helpful, Thanks much @Vitor Jr. @Mohamed Ettaki Talbi
Mohamed Ettaki Talbi:
Mohamed Ettaki Talbi:
you can copy/paste question and NP/pods yaml here