user_mda
user_mda

Reputation: 19398

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?

Upvotes: 0

Views: 464

Answers (2)

kewne
kewne

Reputation: 2298

There’s a handler for it in https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/handlers/NetworkPolicyHandler.java, so I guess it’s supported. The actual NetworkPolicy class seems to be in a dependency library, kubernetes-model.

Upvotes: 1

Hrishikesh
Hrishikesh

Reputation: 380

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.

Upvotes: 1

Related Questions