/cni-from-scratch

Kubernetes networking: CNI plugin from scratch, in bash

Primary LanguageShellGNU Affero General Public License v3.0AGPL-3.0

Kubernetes networking: Writing a CNI plugin from scratch

This repository holds the complete implementation of the examples seen in Kubecon Barcelona talk, 2019.

Kubernetes networking: Writing a CNI plugin from scratch / Eran Yanay — Video | Slides ]

Prerequisits

  • Two node K8s cluster. Kubeadm works just fine.
  • Nodes IPs should be hardcoded into init.sh
  • demo.yaml nodeSelector should be modified according to your cluster node names
  • Modify 10-my-cni-demo.conf, with podcidr field to correspond to the specific node pod cidr range. Can see podcidr range by running kubectl describe node. This should be modified for every node

Installation

Deploy into a K8s cluster by following the next steps:

  1. Copy my-cni-demo to /opt/cni/bin/my-cni-demo
  2. Copy the modified config file to /etc/cni/net.d/
  3. Copy the modified init script to each node, and run it at least once after restart. The changes it perform are not persistent.

Usage

Apply the demo config yaml by running kubectl apply -f demo.yaml