A simple CNI plugin for a home Kubernetes cluster.
GOOS=linux GOARCH=amd64 go build -o bin/my-cni ./cmd/my-cni/Transfer the binary to the node:
scp bin/my-cni <user>@<node>:/tmp/my-cniInstall the binary:
ssh <user>@<node>
sudo mv /tmp/my-cni /opt/cni/bin/my-cni
sudo chmod +x /opt/cni/bin/my-cniPlace the CNI config (set subnet and gateway per node):
sudo tee /etc/cni/net.d/10-my-cni.conf <<'EOF'
{
"cniVersion": "1.0.0",
"name": "my-cni",
"type": "my-cni",
"bridgeName": "cni0",
"mtu": 1500,
"ipam": {
"type": "host-local",
"subnet": "<node-pod-cidr>",
"gateway": "<node-pod-gateway>"
}
}
EOF