Skip to content

Instantly share code, notes, and snippets.

View aojea's full-sized avatar

Antonio Ojea aojea

View GitHub Profile
@aojea
aojea / netperf.yaml
Last active August 27, 2023 14:47
netperf network performance test kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: netperf-server
labels:
app: netperf-server
spec:
replicas: 1
selector:
matchLabels:
@aojea
aojea / README.md
Last active December 22, 2023 19:58
Test even loadbalancing

Create the deploymentn with 100 backends and one Service

kubectl apply -f backends.yaml

Run a pod to test the Service using the httptest program, that allows to specify different parameters of the http connections

./httptest -h
Usage: httpget [options] [url]
@aojea
aojea / README.md
Last active March 26, 2024 13:13
BPF cheatsheet
@aojea
aojea / README.md
Last active January 22, 2024 07:42
service loadbalancer deleteion

Service LoadBalancer deletion

Services of Type: LoadBalancer are handled by external controllers.

These controllers need to handle the infrastructure necessary to provisiong the external Loadbalancer, and use finalizers to avoid deleting the Service before all the necessary steps are done.

Kubernetes provide a reference implementation of a controller for Loadbalancers in https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/cloud-provider/controllers/service/controller.go

Example

@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 / README.md
Created May 5, 2023 08:26
Ingress-nginx load sharing

Install ingress-nginx

kubectl create clusterrolebinding cluster-admin-binding   --clusterrole cluster-admin   --user $(gcloud config get-value account)
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.7.0/deploy/static/provider/cloud/deploy.yaml

Scale the ingress-controller to have two replicas:

@aojea
aojea / README.md
Last active April 16, 2023 09:21
Noop ipmasq-agent
$ wget https://gist.githubusercontent.com/aojea/50ec0d10807d1907ecc6ece526f991da/raw/15371f0f2cf48f2e6a75db7f71a7e674e8dfc624/ipmasq.yaml -O ipmasq-noop.yaml
$ kubectl apply -f ipmasq-noop.yaml
configmap/ip-masq-agent configured
daemonset.apps/ip-masq-agent unchanged
@aojea
aojea / README.md
Last active April 12, 2023 22:23
gce ipv6 only cluster

GCE IPv6 only cluster

These scripts create an IPv6 only cluster on GCE using GUA for both Pods and Services. The scripts use kubeadm and there are not fully automated, this is some personal and exploratory work, so some manual steps are required.

Using GUAs everywhere allows to connect directly to Pod and Services:

  • with the benefit that everything is routed and there is no need for lodabalancers or nodePorts
  • with the con that everything is public and you need to create firewall rules accordenly
@aojea
aojea / README.md
Created April 3, 2023 11:50
zero downtime deployment rolling update
  1. Create the deployment and expose it using a Load Balancer
 kubectl apply -f demo.yaml
  1. Wait for the LoadBalancer
apiVersion: apps/v1
kind: Deployment
metadata:
name: server-deployment
labels:
app: MyApp
spec:
replicas: 2
selector:
matchLabels: