Skip to content

Instantly share code, notes, and snippets.

@bachmanity1
bachmanity1 / install-k8s-1.35-longhorn-master.sh
Last active August 16, 2026 14:18
Install a single-node Kubernetes v1.35 cluster with Longhorn master-head
#!/usr/bin/env bash
set -Eeuo pipefail
KUBERNETES_MINOR="${KUBERNETES_MINOR:-v1.35}"
POD_CIDR="${POD_CIDR:-10.244.0.0/16}"
FLANNEL_VERSION="${FLANNEL_VERSION:-v0.28.9}"
LONGHORNCTL_VERSION="${LONGHORNCTL_VERSION:-v1.12.1}"
LONGHORN_UI_NODE_PORT="${LONGHORN_UI_NODE_PORT:-30080}"
LONGHORN_NAMESPACE="longhorn-system"
LONGHORN_MANAGER_IMAGE="${LONGHORN_MANAGER_IMAGE:-docker.io/dauren2495/longhorn-manager:localci-20260814-055609-m87b4c88-i183eea2}"
@bachmanity1
bachmanity1 / show-spdk-masks.sh
Created July 23, 2026 07:34
Read-only: print host IRQ/workqueue/RPS CPU masks compactly (changes nothing)
#!/bin/bash
# Read-only: print current host IRQ / workqueue / RPS CPU masks compactly.
# Changes NOTHING. No arguments, no root strictly required (some files may be
# unreadable without it, shown as '?').
set -uo pipefail
log() { echo "$(date '+%Y-%m-%d %H:%M:%S') $*"; }
compact() {
# reads mask values on stdin, prints "value (xN)" groups on one line
@bachmanity1
bachmanity1 / steer-away-from-spdk.sh
Last active July 23, 2026 03:11
Steer host IRQ/workqueue/RPS away from SPDK reactor cores (given SPDK cpu mask)
#!/bin/bash
# Steer host kernel work (IRQ / workqueue / RPS) away from SPDK CPUs.
#
# Usage: steer-away-from-spdk.sh <spdk_cpu_mask>
# <spdk_cpu_mask> hex bitmask of CPUs used by spdk_tgt, e.g. 0x3 (CPU 0,1)
#
# It computes "all online CPUs AND NOT spdk_mask" and pins:
# - IRQ smp_affinity (default + per-IRQ)
# - unbound workqueue cpumask (global + per-workqueue)
# - RPS rps_cpus on physical NICs
@bachmanity1
bachmanity1 / ceph-cleanup.sh
Created March 10, 2026 08:55
Run ceph-v2-manage.sh cleanup for each host
#!/bin/bash
set -euo pipefail
for h in "$@"; do
echo "=== Cleanup: ${h}.n3r ==="
./ceph-v2-manage.sh cleanup -l "${h}.n3r" -p ceph-v2 --skip-check -v
done
@bachmanity1
bachmanity1 / ceph-host-check.sh
Created March 10, 2026 07:19
Check if Ceph hosts are fully removed (daemons, host list, crush map)
#!/bin/bash
set -euo pipefail
HOST_FILE=""
HOSTS=()
usage() {
echo "Usage: $0 [--file <hosts-file>] [hostname ...]"
echo ""
echo "Verifies that hosts are fully removed: no daemons, not in host list, not in crush map."
@bachmanity1
bachmanity1 / ceph-host-drain-dryrun.sh
Created March 10, 2026 07:11
Ceph host drain dry run: crush weight check only
#!/bin/bash
set -euo pipefail
POLL_INTERVAL=10
TIMEOUT=1800 # 30 minutes
HOST_FILE=""
HOSTS=()
MODE="drain" # drain or check
usage() {
@bachmanity1
bachmanity1 / ceph-host-drain-dryrun.sh
Last active March 10, 2026 07:10
Dry run: check CRUSH weight only
#!/bin/bash
set -euo pipefail
POLL_INTERVAL=10
TIMEOUT=1800 # 30 minutes
HOST_FILE=""
HOSTS=()
MODE="drain" # drain or check
usage() {
@bachmanity1
bachmanity1 / ceph-host-drain.sh
Last active March 10, 2026 08:29
Ceph host drain, remove, and cleanup script
#!/bin/bash
set -euo pipefail
POLL_INTERVAL=10
TIMEOUT=1800 # 30 minutes
HOST_FILE=""
HOSTS=()
MODE="drain" # drain or check
usage() {
@bachmanity1
bachmanity1 / check-crush-weight.sh
Created March 10, 2026 06:43
Check if Ceph CRUSH weight is zero for hosts
#!/bin/bash
set -euo pipefail
HOST_FILE=""
HOSTS=()
usage() {
echo "Usage: $0 [--file <hosts-file>] [hostname ...]"
echo ""
echo "Checks if CRUSH weight is zero for each specified host."
@bachmanity1
bachmanity1 / check-crush-weight.sh
Last active March 10, 2026 06:31
Check if Ceph CRUSH weight is zero for hosts
#!/bin/bash
set -euo pipefail
HOST_FILE=""
HOSTS=()
usage() {
echo "Usage: $0 [--file <hosts-file>] [hostname ...]"
echo ""
echo "Checks if CRUSH weight is zero for each specified host."