OVN Kubernetes Presentation OCTO October6th2020
OVN Kubernetes Presentation OCTO October6th2020
OVN Kubernetes Presentation OCTO October6th2020
Openshift Networking +
OVN-Kubernetes
An introduction for beginners [Recording]
1
V0000000
CONFIDENTIAL designator
Agenda
● OVN Kubernetes
○ What is it, where does it fit in Openshift?
○ Architecture and components
● What happens when a Pod is created
○ How is IP allocated?
○ What points in the OVN-K8’s codebase are touched
○ What OVN networking entities are created
● The lifecycle of an ICMP packet
○ Inter-node pop2pod within cluster
Future talks:
- More packet tracing and deeper dives into the layers below OVN, OVS, Linux datapaths, etc.
2
V0000000
CONFIDENTIAL designator
eth0
3
https://github.com/containernetworking/cni/blob/master/SPEC.md
V0000000
https://kubernetes.io/docs/concepts/cluster-administration/networking/
CONFIDENTIAL designator
Openshift
OVN
4.6
Kubernetes
● Openshift implements it’s networking framework within the CNO(Cluster Network Operator)
○ It currently supports three main network types (CNI’s) -> OpenShiftSDN, OVNKubernetes, Kuryr
● Multus is a meta plugin that allows pods to have multiple network interfaces
4
V0000000
https://www.openshift.com/blog/demystifying-multus
Big Picture UPDATED 5/1/21
CONFIDENTIAL designator
OPENSHIFT
KUBERNETES CNI
OpenShift Tigera
VMware Isovalent VMware Juniper kuryr-
SDN OVN Calico Cisco ACI kubernetes2
NCP Cilium Antrea Contrail
DEFAULT (open src)
OVN-Kubernetes
6
V0000000
CONFIDENTIAL designator
These processes are started by the CNO via a Daemonset -> ovnkube-master
OVN
southbound DB They can be seen running on an OCP cluster in the openshift-ovn-kubernetes
Master Node
namespace within the ovnkube-master pod as the following containers
● [northd, nbdb, sbdb, ovnkube-master]
7
V0000000
https://docs.google.com/presentation/d/1iktpCdAsdaJPJe7Yk36T-BtYwuB04oc3lHdMHH2qBcw/edit#slide=id.g6fa84b026f_2_109
CONFIDENTIAL designator
ovn-kubernetes
OVS database
It can be seen running on an OCP cluster in the openshift-ovn-kubernetes
node namespace within the ovs-node pods as the following containers
● [ovs-daemons]
OVS bridge
NIC
Worker Node
8
V0000000
https://docs.google.com/presentation/d/1iktpCdAsdaJPJe7Yk36T-BtYwuB04oc3lHdMHH2qBcw/edit#slide=id.g6fa84b026f_2_109
CONFIDENTIAL designator
ovn-kubernetes
● OVN-Kubernetes node
node
OVS database ○ Called as CNI plugin (just an executable) from kublet/CRI-O
○ Digests IPAM annotation written by ovn-kubernetes master
○ Sets up firewall rules and routes for HostPort and Service access from
node
OVS bridge ○ Creates OVS port on bridge, moves it into pod network namespace, sets
IP details/QoS
NIC ○ Deletes entities when pods die
Worker Node
These process are also started by the CNO via a Daemonset-> ovnkube-node
They can be seen running on an OCP cluster in the openshift-ovn-kubernetes
namespace within the ovnkube-node pod as the following containers
9
● [ovn-controller, ovnkube-node] V0000000
https://docs.google.com/presentation/d/1iktpCdAsdaJPJe7Yk36T-BtYwuB04oc3lHdMHH2qBcw/edit#slide=id.g6fa84b026f_2_109
Local GW Topology Overview
CONFIDENTIAL designator
Updated:
06/25/2021
10
V0000000
Shared GW Topology Overview
CONFIDENTIAL designator
Updated:
06/25/2021
11
V0000000
CONFIDENTIAL designator
watcher
etcd kube-apiserver scheduler
12
V0000000
CONFIDENTIAL designator
apiVersion: v1
kind: Pod
metadata:
name: client
namespace: default
spec:
containers:
- name: client
image: xxx
watcher
etcd kube-apiserver scheduler
13
V0000000
CONFIDENTIAL designator
apiVersion: v1
kind: Pod
metadata:
name: client
namespace: default
spec:
containers: Aha!
- name: client New pod
image: xxx
watcher
etcd kube-apiserver scheduler
14
V0000000
CONFIDENTIAL designator
apiVersion: v1
kind: Pod
metadata:
name: client
namespace: default
spec:
containers:
- name: client
image: xxx
nodeName: node1
watcher watcher
etcd kube-apiserver scheduler
15
V0000000
CONFIDENTIAL designator
apiVersion: v1
kind: Pod
metadata: kubelet
name: client
namespace: default
spec:
her
containers: tc node1
- name: client wa
image: xxx
nodeName: node1
watcher
kube-apiserver watch
etcd er
ovnkube-master
16
master V0000000
CONFIDENTIAL designator
17
V0000000
CONFIDENTIAL designator
ovnkube node
18
- https://github.com/ovn-org/ovn-kubernetes/blob/22c61bd81deb347e8ad94ae3191c1f4e1fc2c5b4/go-controller/pkg/cni/cni.go#L140 V0000000
- https://github.com/ovn-org/ovn-kubernetes/blob/22c61bd81deb347e8ad94ae3191c1f4e1fc2c5b4/go-controller/pkg/cni/cni.go#L68
- https://github.com/ovn-org/ovn-kubernetes/blob/22c61bd81deb347e8ad94ae3191c1f4e1fc2c5b4/go-controller/pkg/cni/cni.go#L165
CONFIDENTIAL designator
/opt/cni/bin/ovn-k8s-cni-overlay
sends request through
http socket
ovn-cni-server.sock ovnkube-node
ovnkube node
19
- https://github.com/ovn-org/ovn-kubernetes/blob/e766bc19d0338c4d11136c5fa97202569d2702f8/go-controller/pkg/cni/helper_linux.go#L279
- https://github.com/ovn-org/ovn-kubernetes/blob/e766bc19d0338c4d11136c5fa97202569d2702f8/go-controller/pkg/cni/helper_linux.go#L140 V0000000
- https://github.com/containernetworking/plugins/blob/e78e6aa5b9fd7e3e66f0cb997152c44c2a4e43df/pkg/ip/link_linux.go#L130
- https://github.com/ovn-org/ovn-kubernetes/blob/e766bc19d0338c4d11136c5fa97202569d2702f8/go-controller/pkg/cni/helper_linux.go#L319
CONFIDENTIAL designator
/opt/cni/bin/ovn-k8s-cni-overlay ○ ofctlExec("dump-flows",
"br-int",
sends request through "table=9,dl_src=mac_addr")
http socket
ovn-cni-server.sock ovnkube-node
ovnkube node
20
- https://github.com/ovn-org/ovn-kubernetes/blob/e766bc19d0338c4d11136c5fa97202569d2702f8/go-controller/pkg/cni/helper_linux.go#L375 V0000000
- https://github.com/openshift/ovn-kubernetes/blob/86b3feb85044261b202c627dda22320506748d8b/go-controller/pkg/cni/ovs.go#L101
CONFIDENTIAL designator
ovnkube-master
master
21
- https://github.com/ovn-org/ovn-kubernetes/blob/d17a8bcfc68e8893c78dac8fd30a40d21ef22194/go-controller/pkg/ovn/ovn.go#L529 V0000000
- https://github.com/ovn-org/ovn-kubernetes/blob/d17a8bcfc68e8893c78dac8fd30a40d21ef22194/go-controller/pkg/ovn/ovn.go#L544
CONFIDENTIAL designator
ovnkube-master
creates logical
objects
nbdb
master
22
- https://github.com/ovn-org/ovn-kubernetes/blob/0c534f8bb21d2950dffcc41d96c255893ccece27/go-controller/pkg/ovn/pods.go#L257 V0000000
CONFIDENTIAL designator
● logicalSwitch := node1
nbdb
master
23
- https://github.com/ovn-org/ovn-kubernetes/blob/0c534f8bb21d2950dffcc41d96c255893ccece27/go-controller/pkg/ovn/pods.go#L296
- https://github.com/ovn-org/ovn-kubernetes/blob/0c534f8bb21d2950dffcc41d96c255893ccece27/go-controller/pkg/ovn/pods.go#L366 V0000000
- https://github.com/ovn-org/ovn-kubernetes/blob/0c534f8bb21d2950dffcc41d96c255893ccece27/go-controller/pkg/ovn/pods.go#L515
- https://github.com/ovn-org/ovn-kubernetes/blob/0c534f8bb21d2950dffcc41d96c255893ccece27/go-controller/pkg/ovn/pods.go#L387
CONFIDENTIAL designator
nbdb
master
24
- https://github.com/ovn-org/ovn-kubernetes/blob/0c534f8bb21d2950dffcc41d96c255893ccece27/go-controller/pkg/ovn/pods.go#L416 V0000000
CONFIDENTIAL designator
nbdb
master
25
- https://github.com/ovn-org/ovn-kubernetes/blob/0c534f8bb21d2950dffcc41d96c255893ccece27/go-controller/pkg/ovn/pods.go#L422 V0000000
- https://github.com/ovn-org/ovn-kubernetes/blob/0c534f8bb21d2950dffcc41d96c255893ccece27/go-controller/pkg/ovn/pods.go#L498
-
CONFIDENTIAL designator
nbdb
wa
tc
h
er
northd
master
26
V0000000
CONFIDENTIAL designator
l ows
a lf
g ic sbdb
nbdb l o
wa
tes
tc
a
h
cre
er
northd
master
27
V0000000
CONFIDENTIAL designator
sbdb
cni-add
CRIO creates a
sandbox executes CNI
creation binary on the veth pair
host through and waits syncs
CNI interface
/opt/cni/bin/ovn-k8s-cni-overlay
sends request through
http socket
ovnkube-node ovn-controller
ovn-cni-server.sock
ovnkube node
28
V0000000
CONFIDENTIAL designator
creates a sbdb
cni-add veth pair
CRIO and waits
sandbox executes CNI
creation assigns IP
binary on the
host through details to
syncs
CNI interface pod
interface
/opt/cni/bin/ovn-k8s-cni-overlay
sends request through
http socket
ovnkube-node ovn-controller
ovn-cni-server.sock
ovnkube node
29
V0000000
CONFIDENTIAL designator
creates a sbdb
veth pair
CRIO and
response
assigns IP
exits binary details to
syncs
pod
interface
/opt/cni/bin/ovn-k8s-cni-overlay
sends request through
http socket
ovnkube-node ovn-controller
ovn-cni-server.sock
ovnkube node
30
- https://github.com/ovn-org/ovn-kubernetes/blob/22c61bd81deb347e8ad94ae3191c1f4e1fc2c5b4/go-controller/pkg/cni/cni.go#L197 V0000000
- https://github.com/ovn-org/ovn-kubernetes/blob/22c61bd81deb347e8ad94ae3191c1f4e1fc2c5b4/go-controller/pkg/cni/cni.go#L162
CONFIDENTIAL designator
ovn-control-plane
Node1 Node2
ovn-worker ovn-worker2
31
server Client
V0000000
Pod Pod
CONFIDENTIAL designator
ovn-control-plane
Node1 Node2
ovn-worker ovn-worker2
Pod Pod
32
V0000000
CONFIDENTIAL designator
33
V0000000
OVN logical entities
CONFIDENTIAL designator
36
V0000000
CONFIDENTIAL designator
37
V0000000
CONFIDENTIAL designator
Ovn-Trace
● To trace a packet through OVN a utility called ovn-trace
○ It simulates packet forwarding scenarios within OVN logical topologies
● A typical ovn-trace command:
40
V0000000
CONFIDENTIAL designator
42
V0000000
CONFIDENTIAL designator
Thank you
Main References:
● OpenShift and OVN Technical Dive by Dan Williams - link
● Would like to thank Tim (ovn-tracing), Casey (pod-creation) for their knowledge base.
● If you have any questions please don’t hesitate to reach us on #forum-sdn @sdn-team on CoreOS slack
43
V0000000