Search code examples
javanetwork-programmingkubernetesfabric8

How to create a NetworkPolicy usingt he Fabric8 java client for Kubernetes


I am reading the Kubernetes docs here https://kubernetes.io/docs/concepts/services-networking/network-policies/

I would assume there is an equivalent object ofr a NetworkPolicy but I didnt find one in the source code or any examples setting the network policy on groups of pods.

Am I looking at the right place?


Solution

  • Here is an example of creating NetworkPolicy using fabric8 kubernetes client.

    https://github.com/fabric8io/kubernetes-client/pull/976

    To select group of pods you can use PodSelector in NetworkPolicySpec.