Skip to content

Instantly share code, notes, and snippets.

View tsanghan's full-sized avatar
🏠
Working from home

tsanghan

🏠
Working from home
View GitHub Profile
@tsanghan
tsanghan / README.md
Created April 15, 2024 04:40 — forked from aojea/README.md
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

@tsanghan
tsanghan / cilium.yaml
Last active February 21, 2024 16:22
cilium
---
# Source: cilium/templates/cilium-agent/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: "cilium"
namespace: kube-system
---
# Source: cilium/templates/cilium-operator/serviceaccount.yaml
apiVersion: v1
@tsanghan
tsanghan / etcdclient.yml
Created November 28, 2023 07:48 — forked from aojea/etcdclient.yml
etcdclient for using on kind deployments (full credit to maulioin) https://mauilion.dev/posts/etcdclient/
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
component: etcdclient
tier: debug
name: etcdclient
namespace: default
spec:
@tsanghan
tsanghan / get-docker-layers.sh
Created April 11, 2023 07:26 — forked from ben0x539/get-docker-layers.sh
pull manifest + layers from a docker image with curl with progress meter visible
#! /usr/bin/env bash
set -euo pipefail
api() {
local type endpoint registry image arg url
type=$1 endpoint=$2 registry=$3 image=$4 arg=$5
url="https://$registry/v2/$image/$endpoint/$arg"
curl --config - <<<"-u $ARTIFACTORY_CREDS" -H "Accept: $type" "$url"
}
@tsanghan
tsanghan / config.toml
Created December 16, 2022 06:26
Containerd config.toml with runsc
disabled_plugins = ["io.containerd.internal.v1.restart"]
imports = []
oom_score = 0
plugin_dir = ""
required_plugins = []
root = "/var/lib/containerd"
state = "/run/containerd"
version = 2
[plugins]
@tsanghan
tsanghan / ca.cnf
Last active February 9, 2023 09:58
Create certificate with SAN
[req]
distinguished_name = req_distinguished_name
x509_extensions = v3_req
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
prompt = no
[v3_req]
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[req_distinguished_name]
@tsanghan
tsanghan / get_bat_musl.sh
Last active August 24, 2022 07:57
Download bat
curl -s https://api.github.com/repos/sharkdp/bat/releases/latest \
| grep "browser_download_url.*tar.gz" \
| grep "musl" | grep "x86_64" \
| cut -d : -f 2,3 \
| tr -d \" \
| sed "s/^\(.*\)$/url = \1/" \
| curl -sSLOK -
@tsanghan
tsanghan / api_backends.conf
Created March 7, 2022 12:37 — forked from nginx-gists/api_backends.conf
Deploying NGINX Plus as an API Gateway, Part 1
upstream warehouse_inventory {
zone inventory_service 64k;
server 10.0.0.1:80;
server 10.0.0.2:80;
server 10.0.0.3:80;
}
upstream warehouse_pricing {
zone pricing_service 64k;
server 10.0.0.7:80;
Add the following in .zshrc:
...
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
...
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
@tsanghan
tsanghan / vimrc
Created February 17, 2022 10:45
minimal vimrc for CKA exam
colorscheme delek
set nu rnu
autocmd FileType yaml,yml,sh setlocal ts=2 sts=2 sw=2 et ai
set pastetoggle=<F10>
inoremap <Up> <Nop>
inoremap <Down> <Nop>
inoremap <Left> <Nop>
inoremap <Right> <Nop>
nnoremap <Up> <Nop>
nnoremap <Down> <Nop>