networkop / meshnet-cni

a (K8s) CNI plugin to create arbitrary virtual network topologies
BSD 3-Clause "New" or "Revised" License
116 stars 27 forks source link

Question - Whether meshnet-cni recognizes pods created as a deployment/stateful set? #23

Closed vparames86 closed 3 years ago

vparames86 commented 4 years ago

I have been using the examples from k8s-topo to deploy a topology via meshnet-cni, but the example yamls use the Kind: Pod for deploying the pods. Since the pods are not deployed as a Deployment/Stateful set, they disappear randomly breaking the topology. Will meshnet create the p2p links If I deploy the pods as Deployment/Stateful Set?

networkop commented 4 years ago

yes, you just need to make sure the number of replicas of a deployment is set to 1.

vparames86 commented 4 years ago

In case of a deployment the pod names will have some UIDs attached to them. Do you use a label selector in that case to identify the pods mentioned in the topology file? Also what happens when a POD restarts? Are the VxLAN and VETH links established again?

networkop commented 4 years ago

oh yeah, my bad, pods are queried by name so it has to be consistent. i guess it should be fairly easy to modify the code for daemon to fall through to label selection and maybe even query a deployment by name as the last resort.

vparames86 commented 4 years ago

Hi Michael, Thanks for your response. I will work on this and see if I can get a PR. Also I want to understand what happens when the POD restarts? Will the VXLAN and VETH links gets re-established on pod restart?

networkop commented 4 years ago

it depends on a kind of restart. generally, all new namespaces are created by a cni plugin so meshnet-cni should detect that.

networkop commented 3 years ago

Added example with stateful sets. https://github.com/networkop/meshnet-cni/blob/master/tests/2node-sts.yml