Inside Kube-OVN: How the Controller Manages VPCs, Workers, and IP Allocation
This article provides a detailed walkthrough of Kube-OVN's controller architecture, covering its deployment as a Kubernetes deployment, the main initialization flow, worker mechanisms for handling VPC, subnet, and pod resources, and the creation of the default VPC with associated OVN logical router.
Controller Deployment
The kube-ovn-controller runs as a Deployment in a Kubernetes cluster. The install.sh script generates manifests based on configuration and applies them. The controller image is kubeovn/kube-ovn:v1.8.0; the entrypoint is the kube-ovn-controller binary.
Main Execution Flow
main Function
The main function creates informers, starts worker loops, and launches the controller.
Worker Model
For each CRD resource (VPC, subnet, pod, etc.) the controller creates a dedicated Go routine with its own work queue. Events are enqueued and processed asynchronously.
VPC Add Event Example
When a VPC add event arrives, it is placed in the VPC work queue. The VPC worker calls InitDefaultVpc() to ensure a default VPC named ovn-cluster exists, then creates an OVN logical router using ovn-nbctl lr-add.
InitDefaultVpc()Default VPC Initialization
After installation Kube‑OVN automatically creates a default VPC ( ovn-cluster). All user‑created subnets and pods belong to this VPC unless a custom VPC is specified. The default VPC includes at least one OVN logical router, providing isolation between VPCs.
VPC Resource Handling
The VPC worker processes add, update, and delete events. For add, it creates the logical router and, for custom VPCs, configures static routes. Subnet and pod workers follow the same queue‑driven pattern.
Key Initialization Commands
# Ensure default VPC
InitDefaultVpc()
# Create logical router (example)
ovn-nbctl lr-add ovn-clusterReferences
Project repository: https://github.com/kubeovn/kube-ovn
Official site: https://www.kube-ovn.io
Slack community: https://kube-ovn-slackin.herokuapp.com
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Cloud Native Technology Community
The Cloud Native Technology Community, part of the CNBPA Cloud Native Technology Practice Alliance, focuses on evangelizing cutting‑edge cloud‑native technologies and practical implementations. It shares in‑depth content, case studies, and event/meetup information on containers, Kubernetes, DevOps, Service Mesh, and other cloud‑native tech, along with updates from the CNBPA alliance.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
