Skip to content

Instantly share code, notes, and snippets.

View aojea's full-sized avatar

Antonio Ojea aojea

View GitHub Profile
@aojea
aojea / daemonset.yaml
Created December 3, 2023 16:18
Daemonset to reconcile nodes ethtool configuration
View daemonset.yaml
# See for more options https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: node-ethtool
namespace: kube-system
labels:
k8s-app: node-ethtool-config
spec:
selector:
@aojea
aojea / features.diff
Last active November 27, 2023 14:07
Kubernetes features evolution
View features.diff
diff --git a/cmd/genfeatures/genfeatures.go b/cmd/genfeatures/genfeatures.go
new file mode 100644
index 00000000000..953305e2715
--- /dev/null
+++ b/cmd/genfeatures/genfeatures.go
@@ -0,0 +1,43 @@
+/*
+Copyright 2023 The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
@aojea
aojea / hostport_deployment.yaml
Created October 19, 2023 10:46
hostport udp pods
View hostport_deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: server-deployment
labels:
app: MyApp
spec:
replicas: 2
selector:
matchLabels:
@aojea
aojea / README.md
Last active October 17, 2023 06:53
Kubernetes ServiceCIDR KEP-1880
View README.md
@aojea
aojea / readme.md
Created September 11, 2023 18:10
Obtain coredump from an application
View readme.md
kubectl get pods -A -o wide | grep dns
kube-system   kube-dns-5bfd847c64-bkkhf                           4/4     Running   0             80m   10.108.0.5    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
aojea / service_selector.yaml
Created August 27, 2023 19:05
Service selector
View service_selector.yaml
apiVersion: v1
kind: Pod
metadata:
name: job1
labels:
job-name: "job1"
job-index: "0"
spec:
hostNetwork: true
containers:
@aojea
aojea / netperf.yaml
Last active August 27, 2023 14:47
netperf network performance test kubernetes
View netperf.yaml
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 9, 2023 12:13
Test even loadbalancing
View README.md

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 June 10, 2023 12:20
BPF cheatsheet
View README.md
@aojea
aojea / README.md
Last active May 11, 2023 15:08
service loadbalancer deleteion
View README.md

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