Skip to content

Instantly share code, notes, and snippets.

$ 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",
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
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;
@sameo
sameo / gist:d49c50772d616ae00e96c9967e676976
Created February 7, 2017 13:57
RSS and PSS, Clean vs Dirty, Private vs Shared
From http://unix.stackexchange.com/questions/33381/getting-information-about-a-process-memory-usage-from-proc-pid-smaps
For a given process in /proc/<pid>/smaps, for a given mapping entry what are:
Shared_Clean
Shared_Dirty
Private_Clean
Private_Dirty
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"

Create an nginx pod:

kubectl run nginx --image=nginx --port=80 --replicas=3
kubectl expose deployment nginx --port=80 
kubectl run busybox-fail --rm -ti --image=busybox /bin/sh
kubectl run busybox --image=busybox --command -- sleep 600
kubectl expose deployment my-nginx --port=80 --type=NodePort
kubectl get svc
kubectl describe service my-nginx