How burlyluo/clab works
Project’s Purpose and Type
• This project is a combined network simulation and Kubernetes deployment lab. It leverages KinD (Kubernetes in Docker) to quickly spin up a Kubernetes cluster and uses Containerlab to create simulated network infrastructure (routers, switches, and network nodes) with Docker containers.
• The goal is to demonstrate how to integrate network resources (with distinct subnets created by Containerlab) into a KinD-based Kubernetes environment, further extended with Calico as the CNI plugin.
File Structure
• Shell Scripts: Files like Deprecated-kind-calico-svc-bgp.sh, adv-clusterip.sh, and label_node.sh suggest automation scripts around network configuration.
• Containerlab Artifacts: The “clab-bgp-cplane-demo” directory and “topo.yaml” file point to the topology definition of the simulated network environment.
• Network Configurations: The “startup-config” directory holds router configuration files (leaf0.cfg, spine0.cfg, etc.) for the virtual routers defined within Containerlab.
• Overall, the file tree shows a clear separation between Kubernetes orchestrations (KinD, Calico) and network lab topologies (Containerlab specific files and configurations).
Main Components
a. KinD-Based Kubernetes Cluster:
• Control Plane Node: “clab-bgp-cplane-demo-control-plane”
• Worker Nodes: “clab-bgp-cplane-demo-worker”, “worker2”, “worker3”
• Calico CNI component configured via calico.yaml (with related CRDs and deployments)
b. Containerlab Network Infrastructure:
• Virtual Routers: Represented by VyOS containers (leaf0, leaf1, spine0, spine1) which have configurations in the startup-config directory.
• Network Nodes/Servers: Linux containers (using burlyluo/nettoolbox image) such as server1, server2, server3, server4.
• Virtual Bridges: “br-leaf0” and “br-leaf1”, which are created in the pre-deployment scripts to provide separate subnets.
• Topology Definition: Highlight that the topology is defined in topo.yaml and evidenced by virtual wires created between interfaces (as shown by the Containerlab logs).
c. Integration Layer:
• That container networking (via Containerlab and Docker networks) supports the creation of distinct subnets and routing for the cluster.
Relationships, Interactions, and Data Flow
– How the Kubernetes cluster is deployed using KinD (with a clear flow from “kind create cluster…” to the deployment of both control-plane and worker nodes).
– How Containerlab uses the topo.yaml configuration to instantiate network devices (routers, servers, and bridges), and then connects these virtual devices using “virtual wires”.
– How Calico is applied to provide Kubernetes networking after the integration is completed.
– The integration where one of the server containers (e.g., server1) is re-configured (via container network mode tricks) to tap into the network resources from Containerlab.
Architectural Patterns and Design Principles
• It demonstrates the use of infrastructure-as-code for network topology (topo.yaml) and declarative Kubernetes configuration (YAML files for cluster and Calico).
• This division encourages clear separation of concerns: one part focused on container orchestration and the other on network simulation.
• That the network configuration is modular (with per-node configuration files for routers) and that routing decisions are enforced via BGP configurations (bgpconfig.yaml and per-node BGP peer configuration files).