Skip to content

Instantly share code, notes, and snippets.

View uablrek's full-sized avatar

Lars Ekman uablrek

View GitHub Profile
@uablrek
uablrek / README.md
Created June 5, 2024 10:31
Enable pod-pod multicast in K8s by using multus+ipvlan

Most CNI-plugins doesn't support pod-pod multicast. A way to fix that is to add an ipvlan network using Multus. Howto install Multus and the whereabouts IPAM in you environemt is not in the scope of this gist.

Assuming multus and whereabouts are installed, create a "NAD" for ipvlan on the main K8s network.

@uablrek
uablrek / readme.md
Last active April 5, 2024 08:38
OCI state in containerd and cri-o

When trying https://github.com/LionelJouin/network-dra with crio instead of containerd it fails. The reason, or at least the first encountered problem, is that the OCI state differs:

Containerd:

{
  "ociVersion": "1.0.2-dev",
  "id": "f8a629809a08c9b1c45fae0fd34328dc29ece873cbe1ece14aaf35a2e370042b",
  "status": "creating",
  "pid": 1151,
@uablrek
uablrek / pod-ping.sh
Last active December 6, 2023 07:26
Ping K8s pods in parallel
#! /bin/sh
##
## pod-ping.sh <src-pod> <dst-selector>
## Env:
## SRC_NS - Source pod namespace
## DST_NS - Destination pods namespace
## Example:
## pod-ping.sh tserver-569b74646b-tnwzj app=tserver
##
if test -z "$2"; then
@uablrek
uablrek / README.md
Last active September 12, 2023 08:31
K8s - core dumps from containers

k8s-coredump

Specify a core pattern on the host:

echo "/var/log/dumps/core.%h.%e.%P" > /proc/sys/kernel/core_pattern

This is global and will be seen inside containers.

Create a binary that causes a core-dump:

@uablrek
uablrek / README.md
Last active March 29, 2023 06:24
Ipv4 address preservation in K8s KinD

Ipv4 address preservation in K8s KinD

In large cluster IPv4 addresses can become a limiting resource. In this gist we explore a way to assign IPv4 addresses to PODs on just some nodes using the MultiCIDRRangeAllocator feature. Project Calico may present other possibilities.

Configuration

@uablrek
uablrek / af_packet.c
Created March 17, 2023 10:06
AF_PACKET buffer increase test program
/*
Provided under the MIT No Attribution License
https://opensource.org/license/mit-0/
Copyright 2023 Lars Ekman <emil71se@yahoo.com>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the “Software”), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
package main
import (
"fmt"
"log"
"net"
"os"
"strings"
)
@uablrek
uablrek / README.md
Last active May 11, 2021 07:15
Kubernetes sig-network e2e tests

Kubernetes sig-network e2e tests

The list was produced by executing e2e tests with --ginkgo.dryRun=true and post-processing the result.

kubetest --provider=skeleton --test \
  --test_args="--ginkgo.focus=\[sig-network\] --ginkgo.dryRun=true --ginkgo.noColor=true" > \
  /tmp/sig-network-tests-raw.txt
grep -oE 'PASSED[^"]*' sig-network-tests-raw.txt | sort > /tmp/sig-network-tests.txt
sed -i -e 's,PASSED ,,' /tmp/sig-network-tests.txt
@uablrek
uablrek / remove-nodeport.go
Created November 7, 2020 08:26
A go program that clears nodePorts for a service on K8s
package main
import (
"context"
"flag"
"fmt"
"log"
"os"
core "k8s.io/api/core/v1"
@uablrek
uablrek / simple-client-2.yaml
Created May 25, 2020 07:08
NSM simple-client with multiple nsmX interfaces
---
apiVersion: apps/v1
kind: Deployment
spec:
selector:
matchLabels:
networkservicemesh.io/app: "simple-client-2"
replicas: 3
template:
metadata: