Skip to content

Instantly share code, notes, and snippets.

View aojea's full-sized avatar

Antonio Ojea aojea

View GitHub Profile
@aojea
aojea / README.md
Last active May 1, 2024 20:29
Poor man container/ network namespaces

Useful for troubleshooing network namespaces problems without having to create containers and the additional functionality

source netns.sh

netns_add ns1 192.168.0.2 192.168.0.1
netns_add ns2 192.168.0.3 192.168.0.1

ping -c 2 192.168.0.2
PING 192.168.0.2 (192.168.0.2) 56(84) bytes of data.
@aojea
aojea / README.md
Last active April 28, 2024 18:06
Run Kubernets conformance tests
@aojea
aojea / README.md
Last active April 22, 2024 05:03
kube-proxy nftables and iptables vs a Service with 100k endpoints

kube-proxy nftables and iptables vs a Service with 100k endpoints

Background

Iptables performance is limited mainly by two reasons:

The kernel community moved to nftables as replacement of iptables, with the goal of removing the existing performance bottlenecks. Kubernetes has decided to implement a new nftables proxy because of this and another reasons explained in more detail in the corresponding KEP and during the Kubernetes Contributor Summit in Chicago 2023 on the session [Iptables, end of

@aojea
aojea / README.md
Last active April 13, 2024 14:52
Kubernetes DNS: Headless services with large number of endpoints

Kubernetes DNS at scale

It seems that is a common practice in HPC and AI/ML environments that use MPI applications to populate a hosts files with all the nodes on the cluster and copy it over all the nodes, ref https://help.ubuntu.com/community/MpichCluster

It is my observation that in Kubernetes, Headless Services are used to implement this Service Discovery This is very handy because it allows to reference a pod by hostname without having to copy over a generace /etc/hosts.

There must also be an A record of the following form for each ready endpoint with hostname of and IPv4 address . If there are multiple IPv4 addresses for a given hostname, then there must be one such A record returned for each IP.

@aojea
aojea / k8s_prom.sh
Last active April 11, 2024 17:42
kubernetes prometheus CI metrics
https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/108414/pull-kubernetes-e2e-gce-100-performance/1499390264190439424
https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/108414/pull-kubernetes-e2e-gce-100-performance/1499390264190439424/artifacts/prometheus_snapshot.tar
TMP_DIR=$(mktemp -d)
cd $TMP_DIR
wget https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/108414/pull-kubernetes-e2e-gce-100-performance/1499390264190439424/artifacts/prometheus_snapshot.tar
tar xvf prometheus_snapshot.tar
touch prometheus.yml
SNAPSHOT=$(ls prometheus/snapshots/)
@aojea
aojea / README.md
Last active March 26, 2024 13:13
BPF cheatsheet
@aojea
aojea / README.md
Last active March 18, 2024 05:54

checkout cilium repo and run it in kind

git clone https://github.com/cilium/cilium.git
cd cilium
REPO_ROOT=$PWD
KUBEPROXY_MODE="none" make kind
make kind-image
make kind-install-cilium
@aojea
aojea / KIND_Networking.md
Last active March 16, 2024 07:27
Use KIND to emulate complex network scenarios

Networking scenarios [Linux Only]

KIND runs Kubernetes cluster in Docker, and leverages Docker networking for all the network features: port mapping, IPv6, containers connectivity, etc.

Docker Networking

KIND uses a docker user defined network.

It creates a bridge named kind

@aojea
aojea / README.md
Last active March 2, 2024 13:35
upgrade kind kubernetes cluster
@aojea
aojea / linked-clone.sh
Last active February 25, 2024 01:59
Script to create a linked clone with libvirt
#!/bin/bash
set -xe
# This script takes as a parameter the name of the VM
# and creates a linked clone
# Ref: https://unix.stackexchange.com/a/33584
# The scripts assumes that it runs from the same folder
# where the vm image is located and it coincides with the
# image name