Skip to content

Instantly share code, notes, and snippets.

@sequix
sequix / kubectl-view-resources
Last active June 13, 2025 03:41
K8S resource allocations details.
#!/usr/bin/env bash
#:set expandtab tabstop=4 shiftwidth=4 autoindent
# Prerequisites:
# brew install coreutils # for numfmt
# brew install jq
# brew install bash
set -euo pipefail
to1() {
local n=${1:-0}
@sequix
sequix / whypending.sh
Last active January 25, 2025 01:37
A script tells you why your K8S pod is Pending. Scheduler extender is not considered.
#!/usr/bin/env bash
# version: 3.1415926
# usages:
# check all nodes: check-scheduler <namespace> <pod>
# check specified nodes: check-scheduler <namespace> <pod> <node1> <node2> <node3>...
# check the node where the 1st pvc is: check-scheduler <namespace> <pod> pvc
set -euo pipefail
to1() {
local n=${1:-0}
@sequix
sequix / cpuset.sh
Last active September 6, 2023 03:06
machine-independent cpuset operations
#!/bin/bash
set -euo pipefail
help() {
printf "cpuset.sh version: 3.1\n"
printf "usage:\n"
printf "cpuset.sh union 0-1 2 3-4,5 => 0-5\n"
printf "cpuset.sh intersect 0-9 4-6 4-5 => 4-5\n"
printf "cpuset.sh minus 0-9 4-5 => 0-3,6-9\n"
printf "cpuset.sh shrink 0,1,2,3 => 0-3\n"