Skip to content

Instantly share code, notes, and snippets.

View rjhowe's full-sized avatar

Ryan Howe rjhowe

  • Red Hat
  • Raleigh
View GitHub Profile
@rjhowe
rjhowe / etcd-size.bash
Last active May 6, 2025 19:46
etcd object size count
for base in kubernetes openshift; do
readarray RESOURCES <<< \
"$(etcdctl --command-timeout=30s \
get --prefix / --keys-only 2>/dev/null | grep -oP "(?<=/${base}.io\/).+?(?=\/)" | sort | uniq)"
for res in "${RESOURCES[@]}"; do
BYTES=$(etcdctl --command-timeout=30s \
get --prefix /${base}.io/$res -w protobuf | wc -c)
COUNT==$(etcdctl --command-timeout=30s \
get --prefix /${base}.io/$res --keys-only | sed '/^$/d' | wc -l)
echo "/${base}.io/$res Count=$COUNT Bytes=$BYTES"
@rjhowe
rjhowe / netperf.md
Last active March 10, 2025 18:42
OpenShift 4 Network Performance Throughput Testing

OpenShift 4 Network Performance Throughput Testing

Issue

  • How do I do performance testing to test the network bewteen nodes and pods?
  • What tool does RedHat use to test network performance?

Environment

  • OpenShift 4

Resolution

---
apiVersion: v1
kind: Namespace
metadata:
name: openshift4-debug
labels:
app: openshift4-debug
---
apiVersion: v1
kind: ServiceAccount
@rjhowe
rjhowe / gist:6116c4cd96430d31260ab7c4e30c8b52
Created February 3, 2025 19:20
AWK to convert dhcp.conf entries to dnsmasq dhcp entries
### DHCP to DNSmasq
awk '
/host/ { if (hostname) print "dhcp-host=" mac "," ip "," hostname; hostname = $2 }
/hardware ethernet/ { mac = $3; sub(";", "", mac) }
/fixed-address/ { ip = $2; sub(";", "", ip) }
END { print "dhcp-host=" mac "," ip "," hostname }
' dhcpd.conf
@rjhowe
rjhowe / unsafesysctl.md
Last active February 2, 2024 16:24
Unsafe sysctl pod level
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
labels:
machineconfiguration.openshift.io/role: worker
name: recreate-backingfsblockdev
spec:
config:
ignition:
version: 3.2.0
@rjhowe
rjhowe / gist:414883db726f1396bf54d1c858f846f8
Created February 7, 2023 21:44
kubectl-dev_tool example
# kubectl-dev_tool audit --subresource="*" --verb=list -o top --by=user -f audit-2023-02-07T15-02-18.917.log
count: 9201, first: 2023-02-07T09:46:41-05:00, last: 2023-02-07T10:02:18-05:00, duration: 15m37.691882s
4071x system:serviceaccount:sysdig-agent:sysdig-agent
574x system:serviceaccount:openshift-machine-config-operator:machine-config-daemon
543x system:serviceaccount:openshift-dns:dns
456x system:apiserver
360x system:serviceaccount:openshift-cluster-node-tuning-operator:tuned
286x system:serviceaccount:openshift-monitoring:prometheus-k8s
275x system:serviceaccount:openshift-operator-lifecycle-manager:olm-operator-serviceaccount
177x system:serviceaccount:openshift-operators:jaeger-operator
oc get nodes -o template --template='{{ range .items }}{{ $desired := index .metadata.annotations "machineconfiguration.openshift.io/desiredConfig" }}{{ $current := index .metadata.annotations "machineconfiguration.openshift.io/currentConfig" }} {{ if $current }} {{ if eq $current $desired }} Node Name: {{ .metadata.name }} {{"\t"}}Machine Config: {{ index .metadata.annotations "machineconfiguration.openshift.io/currentConfig" }} {{ println }}{{ end }}{{ if ne $current $desired }} Current != Desired {{"\t"}} Node Name: {{ .metadata.name }} {{"\t"}} Current: {{ index .metadata.annotations "machineconfiguration.openshift.io/currentConfig" }} {{"\t"}} Desired: {{ index .metadata.annotations "machineconfiguration.openshift.io/desiredConfig" }}{{ println }}{{ end }}{{ end }}{{ end }}'
@rjhowe
rjhowe / Containerfile
Created September 1, 2022 15:37
Just a basic Containerfile template.
FROM quay.io/fedora/fedora
RUN dnf -y update && dnf clean all && \
INSTALL_PKGS="\
ncat \
openssl \
&& \
dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \

ROUGH NOT FULLY TESTED

  1. Create and Attach volume to masters at /dev/vdb via OpenStack

  2. Create test machine-config

apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
  labels: