Skip to content

Instantly share code, notes, and snippets.

View johscheuer's full-sized avatar

Johannes Scheuermann johscheuer

View GitHub Profile

Keybase proof

I hereby claim:

  • I am johscheuer on github.
  • I am johscheuer (https://keybase.io/johscheuer) on keybase.
  • I have a public key ASB3ppWCeUQQr6iHJejxYs9812v-4RS1lxJQ8kqhiJI3hwo

To claim this, I am signing this object:

@johscheuer
johscheuer / get_pod_netns.sh
Last active April 24, 2024 17:38
This script get's the netns from a Kubernetes pod
#### WAY with crictl
#### TODO validate crictl with docker runtime !!
# Get all pods of a specific node
#kubectl get po --field-selector=spec.nodeName="fluffy-master" --all-namespaces
kubectl get --all-namespaces po --field-selector=spec.nodeName=="$(hostname)" -o json | jq -r '.items[] | select(.status.hostIP!=.status.podIP) | "\(.metadata.name) \(.metadata.namespace)"'
# Get the Pod ID of the Pod with crictl
POD_ID=$(sudo crictl pods --name=nginx-6f858d4d45-vnszm --namespace=default -q --no-trunc)
modinfo 8021q
echo "8021q" >> /etc/modules
# last digest e.g. tb37 -> 37
IP=37
echo ${IP}
# Controll Network
tee /etc/sysconfig/network-scripts/enp4s0f1.101 <<-'EOF'
DEVICE=enp4s0f1.101
func getHostnameFromConnection(connection, defaultHost string) string {
host, _, err := net.SplitHostPort(connection)
if err != nil {
host = defaultHost
fmt.Println(err)
}
return host
}

Keybase proof

I hereby claim:

  • I am johscheuer on github.
  • I am johscheuer (https://keybase.io/johscheuer) on keybase.
  • I have a public key whose fingerprint is 7294 702F D09C 6DA0 5254 3E1E 43C9 AF6D 25F3 CC7F

To claim this, I am signing this object: