-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NetworkPolicy support #842
Comments
@phcollignon I think that some users reported in the channel that they had network policies working in kind using calico. |
Thanks, I'll give it a try. And if I succeed I'll document it .. |
Related to the above discussion... Calico can deploy only to use network policy (i.e. policy-only mode). func generateHostVethName(prefix, namespace, podname string) string {
h := sha1.New()
h.Write([]byte(fmt.Sprintf("%s.%s", namespace, podname)))
return fmt.Sprintf("%s%s", prefix, hex.EncodeToString(h.Sum(nil))[:11])
} We have been successfully using Calico NetworkPolicy with a modified plugin. Our example is here. |
Thanks .. for advice. I'll try it. My main usage is Kubernetes for DEV on local laptop. |
Kindnet is using the standard CNI plugins https://github.com/containernetworking/plugins |
Storage has a tracking issue and is a bit thorny, we're working with sig-storage upstream. It's possible to deploy something today, but multi-node local storage options for testing are pretty limited at the moment for the entire ecosystem, we aim to fix that. for single node the CSI local hostpath driver should work, or the rancher local storage system. currently what we ship is roughly the same as what kubeadm-dind-shipped is the same as what hack/local-up-cluster.sh ships... Network policies can be used also by simply disabling the built in CNI and deploying your preferred CNI. we don't currently ship them as they don't seem to be widely depended on including for kubernetes's own testing, but we might in the future.
AFAIK GKE also supports containerd nodes using upstream ptp, and has a calico network policy only option ... perhaps we only need to tweak some config. I'd prefer to get this working with the upstream ptp plugin than need to ship our own. |
Indeed, modifying CNI PTP plugin may not be the best way.
I did not think option 1 would be accepted by CNI because CNI does not define how to obtain Kubernetes Pod NamespacedName information. It is merely a k8s convention for CNI (shown in this issue). I think option 3 is a reasonable choice. |
@kfyharukz I think that the problem that you are describing is a Calico feature, not a Kubernetes feature.
Calico's Kubernetes network policies work with kindnet, however, Calico has more features, like WorkloadEndpoint that doesn't :). In order to use Calico's only network policies you should replace kindnet and use Calico as the CNI., disabling kindnet in the kind config file and installing Calico once kinds create the cluster.
|
Little feedback to confirm that NetworkPolicy is supported with Calico CNI.
Then install Calico and disable rpf check (not sure it is still needed):
Then I started the cluster again and checked some NetworkPolicies which seem to work as excpeted.
Thanks to all of you for the hints |
/close seems this issue was already solved |
@aojea: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
we may or may not want to target testing the network policy API in kubernetes e2e testing anyhow. this is still something to think about. |
I'll be revisiting this this quarter, looking at increasing kubernetes test coverage. |
this topic is interesting for sig-network, there is also a group to work in a possible network policy v2. |
You can use this in the meantime https://github.com/aojea/kube-netpol/blob/main/README.md#install |
Ok, this is the official one https://github.com/kubernetes-sigs/kube-network-policies |
I guess this is resolved ? Sounds like the solution suggested here is "for kind you can install a cni after the fact like calico or antrea or ovn.... or you can run the kube-network-policies daemonset", but kind itself won't bootstrap a netpol implementation for you, it's outside the scope of the project. |
it is the same with the loadbalancer, you can use |
We can consider default installing this one, currently we only default install binaries/components that either:
But that line is semi-arbitrary and testing Kubernetes is important to us. IF we started including network policy we would need to either bundle it with our "CNI" or add another similar knob for not-installing it.
Yes, but testing security policies is a thing even as a cluster end user, even if KIND clusters have poor security you're going to install RBAC rules etc. I think the question is:
.... Re-evaluating this is on my TODO list next time we get a chance to sync :-) |
I think cloud-provider-kind is a bit different .... we'll have to think about this one as well. |
Conformance APIs sounds like a good bar |
It seems feedback from users is that having network policies in kind by default is a good feature to have /priority important-soon Talked with @neolit123 and kubeadm policies will not accept them, so this implies we have to implement similar to the local-storage addon.
or
/assign @aojea @BenTheElder |
here you are , if someone wants to do beta testing #3611 |
Implemented |
This is available now, in https://github.com/kubernetes-sigs/kind/releases/tag/v0.24.0 |
Hello,
Is there any support for network policies in kind ?
(calico CNI plugin or any other network plugin with NetworkPolicy support ?)
Does kindnet support it ? is it the default network plugin ?
Thanks
The text was updated successfully, but these errors were encountered: