Skip to content

Instantly share code, notes, and snippets.

@mowings
mowings / tmux.md
Created April 19, 2021 20:17
tmux command to renumber windows

tmux movew -r

@mowings
mowings / OOM-Killed.md
Last active April 15, 2021 13:58
Kubernetes/docker -- find OOM-Killed container based on cgroup in kernel log

Given a kernel message like this: Memory cgroup stats for /kubepods/burstable/poda38ff820-1609-44cc-9778-7aa9f8e1ac88/f2b5ea544ea9bbf38034d5a42df74d5cd131bd1d1a808d4e40615ca9f636b34c:

The container id is : f2b5ea544ea9bbf38034d5a42df74d5cd131bd1d1a808d4e40615ca9f63 -- the bit after the pod id (after the slash)

Use docker ps to find the container: docker ps | grep f2b5ea544ea

@mowings
mowings / README.md
Created April 15, 2021 13:43
Kubernetes PID exhaustion (fork rejected by pids controller in /kubepods...)

Kernel errors like:

kubernetes cgroup: fork rejected by pids controller in /kubepods/burstable/... accompainied by errors creating threads or starting processes on base OS can be caused by the kubepods cgroup pids.max being to low

cat /sys/fs/cgroup/pids/kubepods/pids.max

If this is low, it can be reset by setting kernel.pid_max to a large number (kernel.pid_max=4194304) then restart kubelet. After a bit, kubepods/pids.max should be bumped up to the same number (can take a few minutes)

@mowings
mowings / readme.txt
Created February 12, 2021 22:47
eks node shell access
https://github.com/kvaps/kubectl-node-shell
@mowings
mowings / get_tag.sh
Last active February 10, 2021 16:20
AWS instance gets one of its own tag values (from stack overflow)
TAG_NAME="Name"
INSTANCE_ID="`wget -qO- http://instance-data/latest/meta-data/instance-id`"
REGION="`wget -qO- http://instance-data/latest/meta-data/placement/availability-zone | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"
TAG_VALUE="`aws ec2 describe-tags --filters "Name=resource-id,Values=$INSTANCE_ID" "Name=key,Values=$TAG_NAME" --region $REGION --output=text | cut -f5`"
@mowings
mowings / readme.txt
Last active April 10, 2023 06:06
haproxy timing events
Timers provide a great help in troubleshooting network problems. All values are
reported in milliseconds (ms). These timers should be used in conjunction with
the session termination flags. In TCP mode with "option tcplog" set on the
frontend, 3 control points are reported under the form "Tw/Tc/Tt", and in HTTP
mode, 5 control points are reported under the form "TR/Tw/Tc/Tr/Ta". In
addition, three other measures are provided, "Th", "Ti", and "Tq".
Timings events in HTTP mode:
first request 2nd request
@mowings
mowings / iptables.sh
Created December 16, 2020 14:59
iptables commands for forwarding through an ethernet interface
#!/bin/bash
# This allows inbound traffic from the vpn to be routed through the thernet interface
# Im this exampe, 192.168.5.0/24 is the vpn subnet, eno1 is the ethernet interface
# These entries allow traffic to/from the vpn subnet to be forwarded to/from the
# ethernet inteface. Note that outbound traffic will be masqueraded
iptables -A FORWARD -i tun+ -j ACCEPT
iptables -A FORWARD -i tun+ -o eno1 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eno1 -o tun+ -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.5.0/24 -o eno1 -j MASQUERADE
@mowings
mowings / silas.md
Last active December 2, 2020 16:41
SILAS

Heading 1

This is heading 1

Bulleted list

  • step 1
  • step 2

Numeric lists

@mowings
mowings / rdp.txt
Created November 16, 2020 20:09
RDP: Open connection to remote host via command line on osx
open "rdp://full%20address=s:192.168.1.2&username=s:misteruser"