Skip to content

Instantly share code, notes, and snippets.

View flrichar's full-sized avatar
Context is key.

Fred Richards flrichar

Context is key.
  • SUSE Rancher
  • Marcellus, NY
View GitHub Profile
@flrichar
flrichar / journal-json-parse.md
Created June 7, 2024 15:25
journal json parsing

K3S Journal JSON Parse

Parse some message fields from k3s' journal logs.

sudo journalctl -u k3s -g detail -n80 -ojson | jq -r '.MESSAGE'  | jq
...
##### Sample output:

{
 "level": "info",
@flrichar
flrichar / wireguard-calicoctl.md
Last active May 21, 2024 11:06
Wireguard for Calico

Enable Wireguard for Calico

Using just a Calico CRD felixconfiguration, instead of vxlan tunnel.

calicoctl patch felixconfiguration default --type='merge' -p '{"spec":{"wireguardEnabled":true}}'

This should only be enabled by direction from your professional services consultant on an as-needed basis after a thorough examination of the specific environmental factors.

@flrichar
flrichar / rancher-ingress-fix.md
Last active May 21, 2024 11:09
Rancher Helm Install Error about Ingress is Misleading

rancher Ingress complaining about spec.rules[0].http.paths[0].pathType ?

This took a bit of digging to figure out. As it turns out, my lab ingress has evolved a little. This env may have had several ingress classes in the past.

  • alpha env behind a LB with Let's Encrypt enabled
  • the error is misleading, the api-resources are OK & pathType IS specified
  • helm install works OK but won't touch ingress, keeps status as failed
  • even backing up ingress to make it net-new fails
@flrichar
flrichar / nix-container.md
Last active April 4, 2024 12:55
Easy nix environment from nerdctl container

Nix packaging in Nerdctl container

Also set up as a task-function with different aliases, options. Sync necessary data to misc volume.

sudo nerdctl -a /run/containerd/containerd.sock -n moby run -e 'PS1=\u@\h:\w\$ ' -it -v /home/user/the-working-project-path/misc:/root/misc nixos/nix:latest
@flrichar
flrichar / check-cve-2024-3094.md
Last active April 1, 2024 16:38
cve-2024-3094 detection

Run as root ...

... or readlink might require a flag like -f and/or the which command might not include root's $PATH so perhaps run under sudo.

This is a little hacky. A better bet for your operations might be Neuvector.

readlink $(awk '/liblzma.so.5/{print $3}' <(ldd $(which sshd))) | grep -qE "liblzma.so.5.6.0|liblzma.so.5.6.1" && echo "Affected by CVE-2024-3094" || echo "Not affected."
@flrichar
flrichar / frr-speaker.md
Last active June 21, 2024 15:39
FRR container inside metallb speaker daemonset

Recent versions of MetalLB include FRR as a software router.

If you are cisco-like check it out ...

kubectl exec -it -n metallb-system ds/speaker -c frr -- vtysh 

Ask your Qualified consultant for analysis the specifics of the frr configuration. Above applies to manifest only.

@flrichar
flrichar / iostat-json.md
Last active January 15, 2024 20:16
json iostat
@flrichar
flrichar / libvirt-ansible-adhoc-inventory.md
Last active January 17, 2024 22:21
Libvirt/Virsh Adhoc Ansible Inventory

Dynamic AdHoc Ansible Inventory

  • domain names need to match ssh host ids
  • dynamic inventory ansible module for community.libvirt.libvirt requires qemu-ga running in guest
  • why not just create a temporary ad-hoc inventory of currently running vms?
  • use as an alias or function or with Taskfile, prevent Task from throwing an error for non-running vms
echo "[running]" $(virsh list --name) | xargs printf "%s\n" > ~/.local/tmp/inventory

ansible -i ~/.local/tmp/inventory -a 'uptime' running
@flrichar
flrichar / calicoctl-rke2.md
Last active April 2, 2024 13:53
Calicoctl and RKE2

Calicoctl included in Canal /Calico images

  • find the calico-node container, bin is located in /calicoctl
  • [Edit]: Rancher canal includes it, but not generic calico
$ kubectl exec -it -n kube-system $(kubectl get pods -n kube-system -l k8s-app=canal --no-headers -o custom-columns=":metadata.name") -c calico-node -- /calicoctl version

Client Version:    v3.26.3
Git commit:        bdb7878af
Cluster Version: v3.26.3
@flrichar
flrichar / Taskfile.yml
Last active November 1, 2023 14:48
work in progress
version: '3'
dotenv: [ '.env' ]
tasks:
cri-name:
deps:
- task: ctl-bin
vars:
CTLBIN: "/var/lib/rancher/rke2/bin/crictl"