Skip to content

Instantly share code, notes, and snippets.

View cfstras's full-sized avatar

Claus F. Strasburger cfstras

  • Düsseldorf, Germany
  • 15:45 (UTC +01:00)
View GitHub Profile
@cfstras
cfstras / -realvnc-virtctl-vnc-macos.md
Last active September 9, 2026 14:35
Making RealVNC work in macOS for kubevirt

Making TigerVNC work in macOS for kubevirt

This is especially useful for KubeVirt, which expects the command remote-viewer to exist when you run virtctl vnc $vm.

brew install vnc-viewer

cat <<EOF > /usr/local/bin/remote-viewer
#!/bin/bash
set -euo pipefail
@cfstras
cfstras / -converting-k3s-controlplane-to-worker-node.md
Created September 9, 2026 14:23
Converting a k3s control-plane to a worker node.

Converting a k3s control-plane to a worker node.

If you want to go from a 5-node-master to a 3-node-master cluster with less etcd quorum.

  1. Drain the node: kubectl drain <node-name> --ignore-daemonsets --delete-emptydir-data --force --timeout=1m
  2. Remove the node from the cluster: kubectl delete node <node-name>
    • Important: Remove from cluster first, otherwise the next step breaks the etcd quorum.
    • Also, you need to run etcdctl member remove $etcd_id first if this breaks the quorum.
    • Use etcdctl member list to find the $etcd_id.
apiVersion: v1
automountServiceAccountToken: true
kind: ServiceAccount
metadata:
name: mig-config-enforcer
namespace: gpu-operator
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
@cfstras
cfstras / -iperf-between-two-nodes.md
Created June 3, 2026 08:54
run an iperf3 test between two pods/nodes in a kubernetes cluster

iperf3 between two kubernetes pods

A simple script to run an iperf3 test between two nodes in a kubernetes cluster.

Helpful to debug pod2pod communication issues in hybrid cloud clusters.

@cfstras
cfstras / -install-gpu-drivers-nvidia-b200.md
Last active March 24, 2026 09:44
Installing GPU drivers on a DGX B200

(driver is outdated)

Note: the better solution would be to use the NVIDIA gpu-operator. They are exclusive -- either install the driver via gpu-operator with driver: {enabled: true} in the helm values -- or manually on your nodes like below:

# This worked on a VM with a RTX 50xx GPU attached (in proxmox, with PCIe Passthrough)

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu$(grep DISTRIB_RELEASE /etc/lsb-release | cut -d'=' -f2 | tr -d '.')/x86_64/cuda-keyring_1.1-1_all.deb
@cfstras
cfstras / usb-ether.sh
Last active January 25, 2026 14:44 — forked from dafta/usb-ether.sh
Steam Deck USB Ethernet
#!/bin/bash
set -euo pipefail
if [[ "$UID" -ne 0 ]]; then
echo "This script needs to be executed as root"
exit 1
fi
vendor_id="0x3000" # Valve
@cfstras
cfstras / -bsd-tar.md
Created December 18, 2025 08:43
BSD Tar with zstd (macOS)
tar -cv --zstd --options zstd:compression-level=22 --options zstd:threads=0 -f archive.tar.zstd files_to_compress/

Tested with bsdtar 3.5.3 (macOS 15.7.1)

@cfstras
cfstras / -terraform-import-existing-kubectl-manifests.sh
Last active October 14, 2025 10:42
Hack to manually re-import kubectl manifests that are already existing in the cluster
#!/bin/bash
set -euo pipefail
backup() {
terraform state pull > state-$(gdate -Iseconds)
}
plan() {
backup
terraform plan -out=tfplan && terraform show -json tfplan | jq . > tfplan.json
@cfstras
cfstras / -cardinality-of-prometheus-metrics
Created June 30, 2025 11:56
Cardinality overview of prometheus metrics
#!/bin/bash -euo pipefail
## Gives you a nice overview over the total timeseries cardinality of a prometheus endpoint.
curl -fsSL http://localhost:9100/metrics | grep -v '^#' | cut -d'{' -f 1 | cut -d' ' -f 1 | sort | uniq -c | sort -gr
public class DateTimeInsanityTests
{
[Fact]
public void YourDateTimeIsInsane()
{
var t = new DateTime();
// Does not throw
Console.WriteLine(new DateTimeOffset(t.ToUniversalTime()));