Skip to content

Instantly share code, notes, and snippets.

CNI spec: https://github.com/containernetworking/cni/blob/master/SPEC.md
CNI flannel plugin: https://github.com/containernetworking/cni/blob/master/Documentation/flannel.md
Flannel: https://github.com/coreos/flannel
Flannel blog entry: https://coreos.com/blog/introducing-rudder/
Main CNI plugins: https://github.com/containernetworking/cni/tree/master/plugins/main
CNI APIs: https://github.com/containernetworking/cni/blob/master/libcni/api.go
CNI Go interface: https://github.com/containernetworking/cni/blob/master/libcni/api.go#L37
OCI CNI Go package: https://github.com/rajatchopra/ocicni (Used by CRI-O)
@sameo
sameo / CRI-O_network_setup_flow.md
Last active November 10, 2016 01:36
CRI-O networking code flow
github.com/kubernetes-incubator/cri-o/server/sandbox.go
  RunPodSandbox()
    oci.NewContainer()
    s.runtime.CreateContainer()
    s.netPlugin.SetUpPod(netnsPath, podNamespace, id, containerName)
    s.runtime.StartContainer()
    
    
github.com/rajatchopra/ocicni/ocicni.go
$ cat /etc/ocid.conf
[ocid.runtime]
runtime="/usr/local/sbin/runc"
$ cat /etc/cni/net.d/10-mynet.conf
{
"cniVersion": "0.2.0",
"name": "mynet",
"type": "bridge",
"bridge": "cni0",
root@netnode:/# ip link show dev phy-br-eth2
8: phy-br-eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 82:a4:31:98:d2:f3 brd ff:ff:ff:ff:ff:ff
root@netnode:/# ip link show dev int-br-eth2
9: int-br-eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether c6:60:28:48:4f:7d brd ff:ff:ff:ff:ff:ff
cat /etc/cni/net.d/10-mynet.conf
{
"cniVersion": "0.2.0",
"name": "mynet",
"type": "bridge",
"bridge": "cni0",
"isGateway": true,
"ipMasq": true,
"ipam": {
"type": "host-local",
@sameo
sameo / CRI-O clear
Last active December 10, 2016 10:58
#!/bin/bash
printf "Killing all Docker containers..."
docker rm -f $(sudo docker ps -a -q) 2> /dev/null
printf "Done\n"
printf "Killing all runC containers..."
for i in `runc list -q`; do
runc kill $i SIGKILL 2> /dev/null
runc delete $i;
diff --git a/src/hypervisor.c b/src/hypervisor.c
index 24f7c85..9aedf04 100644
--- a/src/hypervisor.c
+++ b/src/hypervisor.c
@@ -90,7 +90,7 @@ out:
* Use a pci slot available on that bus after adding an offset to take
* into account busy slots and the slots used earlier in our qemu options.
*/
-#define QEMU_FMT_DEVICE "driver=virtio-net-pci,bus=/pci-lite-host/pcie.0,addr=%x,netdev=%s"
+#define QEMU_FMT_DEVICE "driver=virtio-net-pci,bus=/q35-pcihost/pcie.0,addr=%x,netdev=%s"
diff --git a/server/container_create.go b/server/container_create.go
index 06c172d..117f386 100644
--- a/server/container_create.go
+++ b/server/container_create.go
@@ -376,7 +376,7 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
if containerInfo.Config != nil && len(containerInfo.Config.Config.Cmd) > 0 {
processArgs = containerInfo.Config.Config.Cmd
} else {
- processArgs = []string{"/bin/sh"}
+ processArgs = []string{podInfraCommand}
@sameo
sameo / Kube-dns.md
Created March 14, 2017 21:57 — forked from mcastelino/Kube-dns.md
kubernetes kube-dns components, debugging

Summary

  • dnsmasq front ends the requests and sends them on to kube-dns

    dnsmasq
      --cache-size=1000
      --no-resolv
      --server=127.0.0.1#10053
    

--log-facility=-

diff --git a/src/spec_handlers/mounts.c b/src/spec_handlers/mounts.c
index bc172e4..c1362ed 100644
--- a/src/spec_handlers/mounts.c
+++ b/src/spec_handlers/mounts.c
@@ -20,6 +20,7 @@
#include "spec_handler.h"
#include "mount.h"
+#include "pod.h"