Skip to content

Instantly share code, notes, and snippets.

@amshinde
amshinde / install-go.md
Last active August 23, 2023 22:42
Install golang on Linux
curl -O https://storage.googleapis.com/golang/go1.11.2.linux-amd64.tar.gz
tar -xvf go1.11.2.linux-amd64.tar.gz
sudo mv go /usr/local
sudo ln -sf /usr/local/go/bin/go /usr/bin/go

vim ~/.bashrc
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
@amshinde
amshinde / time-change-ubuntu.md
Last active June 22, 2023 06:12
Change time on Ubuntu
@amshinde
amshinde / Nested_VFIO.md
Created May 17, 2023 06:27 — forked from sboeuf/Nested_VFIO.md
How to test VFIO with virtio-net-pci device

Prepare the host

Get the image clear-XXXXX-kvm.img

wget https://download.clearlinux.org/releases/30080/clear/clear-30080-kvm.img.xz
unxz clear-30080-kvm.img.xz

Add intel_iommu=on to the kernel boot parameters

mkdir mount_dir
@amshinde
amshinde / qemu_direct_kernel_boot_disk.md
Created April 25, 2023 18:47 — forked from mcastelino/qemu_direct_kernel_boot_disk.md
QEMU Direct Kernel Boot into a disk image
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
VMN=${VMN:=1}
NEMU=~/build-x86_64/x86_64-softmmu/qemu-system-x86_64
sudo $NEMU \
-trace events=/tmp/events \
@amshinde
amshinde / bpftrace.md
Created April 24, 2023 21:28 — forked from krsna1729/bpftrace.md
bpftrace one-liners skbdump
$ sudo bpftrace -e 'tracepoint:napi:napi_poll /comm == "ping"/ { printf("%s\n", comm) }'
Attaching 1 probe...
ping
ping
ping
$ sudo bpftrace -e 'tracepoint:napi:napi_poll /comm == "ping"/ { printf("%d\n", args->work) }'
@amshinde
amshinde / canal.md
Created April 24, 2023 21:26 — forked from krsna1729/canal.md
tracing network stack for MACVLAN IPVLAN

This is only a trace on vxlan interface on the host. not from within container namespace

  ping-26819 [001]  3678.931358: fib_table_lookup:     table 254 oif 0 iif 1 proto 17 0.0.0.0/40784 -> 10.244.2.4/1025 tos 0 scope 0 flags 0 ==> dev flannel.1 gw 10.244.2.0 src 10.244.0.0 err 0
  ping-26819 [001]  3678.931387: fib_table_lookup:     table 254 oif 0 iif 1 proto 17 10.244.0.0/40784 -> 10.244.2.4/1025 tos 0 scope 0 flags 0 ==> dev flannel.1 gw 10.244.2.0 src 10.244.0.0 err 0
  ping-26819 [001]  3678.931468: fib_table_lookup:     table 254 oif 0 iif 1 proto 1 0.0.0.0/0 -> 10.244.2.4/0 tos 0 scope 0 flags 0 ==> dev flannel.1 gw 10.244.2.0 src 10.244.0.0 err 0
  ping-26819 [001]  3678.931485: fib_table_lookup:     table 255 oif 0 iif 0 proto 0 0.0.0.0/0 -> 10.244.2.4/0 tos 0 scope 0 flags 0 ==> dev flannel.1 gw 10.244.2.0 src 10.244.0.0 err 0
  ping-26819 [001]  3678.931499: net_dev_queue:        dev=flannel.1 skbaddr=0xffff919236689800 len=98
  ping-26819 [001]  3678.931500: net_dev_start_xmit:   dev=flann
@amshinde
amshinde / kcgroups.md
Created April 24, 2023 21:23 — forked from mcastelino/kcgroups.md
Kubernetes and cgroups Resource Management/Static cpuManagerPolicy/Memory and Resource Isolation & Scheduling

Overview

The goal of this document to cover all aspects of Kubernetes management, including how resources are expressed, constrained and accounted for. This started a way to ensure that alternate container runtime implementation like Kata containers will behave from a resource accounting and consumption point of view in the same manner as runc.

Location of the latest version of this document: https://gist.github.com/mcastelino/b8ce9a70b00ee56036dadd70ded53e9f

If you do not understand cgroups please refer to a quick primer at the bottom of this document. This will help you understand how the resource enforcement actually works.

Kubernetes Resource Management

@amshinde
amshinde / podman_on_ubuntu.md
Created April 5, 2019 21:43
Rootless podman on Ubuntu

Install podman and uidmap

sudo add-apt-repository ppa:projectatomic/ppa
sudo apt-get update
sudo apt-get install podman uidmap
echo "$(whoami):10000:65536" | sudo tee /etc/subuid
echo "$(whoami):10000:65536" | sudo tee /etc/subgid
echo -e "[registries.search]\nregistries = ['docker.io']" | sudo tee /etc/containers/registries.conf

Guide for Cross-compilation of rust binaries (for eg. s390x)

The following steps describe the setup required to cross-compile a rust binary on a amd64 platform. These steps setup the cross-compile toolchain on the host itself. After going through these steps manually, I came accross a tool cross that makes the process way easier. It uses docker for the build and does not require any changes to the host. Jump to the section directly if you dont want to make any changes to the host.

Install the cross-compiler for s390x

@amshinde
amshinde / qemu-SCSI-Passthrough.md
Last active September 28, 2022 11:29
Qemu SCSI passthrough