# Mycelium CNI Plugin A Container Network Interface (CNI) plugin that enables Kubernetes containers to connect to the Mycelium network. ## Overview This CNI plugin integrates with the Mycelium overlay network to provide IPv6 connectivity for Kubernetes containers. It creates veth pairs and assigns IPv6 addresses from the host's Mycelium /64 block to containers. ## Prerequisites - Mycelium daemon running on the host - Go 1.21+ - Root privileges for installation ## Installation ```bash # Build the plugin make build # Install plugin and configuration make install ``` ## Configuration The plugin uses a CNI configuration file (`10-mycelium.conflist`) that specifies the Mycelium interface name: ```json { "cniVersion": "1.0.0", "name": "mycelium-network", "plugins": [ { "type": "mycelium-cni", "myceliumInterface": "mycelium" } ] } ``` ## How it Works 1. **ADD Operation**: Creates a veth pair, moves one end to the container namespace, assigns an IPv6 address from the Mycelium prefix, and sets up routing. 2. **DEL Operation**: Cleans up the host-side veth interface when containers are destroyed. ## Testing Start Mycelium daemon first: ```bash sudo mycelium --peers tcp://188.40.132.242:9651 tcp://136.243.47.186:9651 ``` Then use with Kubernetes or test directly with CNI tools. ## Architecture Based on the docker-demo.sh script, this plugin: - Uses IPv6 addressing from Mycelium's /64 block - Creates veth pairs for container connectivity - Sets up routing for Mycelium network (400::/7) - Enables IPv6 forwarding on the host