Skip to content

Instantly share code, notes, and snippets.

View full-sized avatar

Antonio Ojea aojea

View GitHub Profile
aojea /
Created September 11, 2023 18:10
Obtain coredump from an application
kubectl get pods -A -o wide | grep dns
kube-system   kube-dns-5bfd847c64-bkkhf                           4/4     Running   0             80m    gke-vanilla-default-pool-ddebe65c-pkzw   <none>           <none>
kubectl debug -n kube-system -it kube-dns-5bfd847c64-bkkhf --image=busybox:1.28 --target=dnsmasq
Targeting container "dnsmasq". If you don't see processes from this container it may be because the container runtime doesn't support this feature.
Defaulting debug container name to debugger-qz6cb.
If you don't see a command prompt, try pressing enter.
aojea / service_selector.yaml
Created August 27, 2023 19:05
Service selector
View service_selector.yaml
apiVersion: v1
kind: Pod
name: job1
job-name: "job1"
job-index: "0"
hostNetwork: true
aojea / netperf.yaml
Last active August 27, 2023 14:47
netperf network performance test kubernetes
View netperf.yaml
apiVersion: apps/v1
kind: Deployment
name: netperf-server
app: netperf-server
replicas: 1
aojea /
Last active June 23, 2023 09:16
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 /
Last active June 10, 2023 12:20
BPF cheatsheet
aojea /
Last active May 11, 2023 15:08
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



checkout cilium repo and run it in kind

git clone
cd cilium
KUBEPROXY_MODE="none" make kind
make kind-image
make kind-install-cilium
aojea /
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

Scale the ingress-controller to have two replicas:

aojea /
Last active April 16, 2023 09:21
Noop ipmasq-agent
$ wget -O ipmasq-noop.yaml
$ kubectl apply -f ipmasq-noop.yaml
configmap/ip-masq-agent configured
daemonset.apps/ip-masq-agent unchanged
aojea /
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