k8snetworkplumbingwg / ovs-cni

Open vSwitch CNI plugin
Apache License 2.0
224 stars 71 forks source link

Can I use k8s service with ovs-cni? #162

Closed mx-zheng closed 3 years ago

mx-zheng commented 3 years ago

Hi guys,

k8s service is based on the kube-proxy and iptables . I don't know whether service is available while ovs-cni is enable in K8s ?

for example , I configure one service called myservice . Can it work normally with ovs-cni ?

apiVersion: v1
kind: Service
metadata:
  name: myservice
spec:
  selector:
    app: myapp
  ports:
  \- protocol: TCP
    port: 80
    targetPort: 80
phoracek commented 3 years ago

Hello. I don't think this would work out of the box. However, maybe you could use Services with Endpoints to achieve this, see https://kubernetes.io/docs/concepts/services-networking/service/#services-without-selectors. I have never attempted it myself, but it looks like it may work. IIUIC you would need to setup IPs on your OVS bridges to allow routing from host to the OVS based network. Then the traffic would go out of a pod (through its primary interface, no OVS), on the host kube-proxy would send it out through the OVS bridge. I may be missing something though.