Category: System Administration

watch multiple Linux commands

Occasionally I’ll have the need to watch screen output of multiple commands on the Linux CLI. Supremely easy but I don’t do it often enough to remember that I need to wrap the sequence in single (‘) or double (“) quotes. Correct formatting is below:

Continue reading “watch multiple Linux commands”

Force delete/restart Kubernetes pods

Occasionally, I have a need to delete and restart k8s pods after I’ve been hammering on a cluster, when I need to perform node maintenance, or when a project has run its course and I want to free up the namespace and/or resources. Below is a general overview of that procedure but note that it is specific to certain scenarios only and assumes you know the consequences of your actions. I do not warranty any of this!

Continue reading “Force delete/restart Kubernetes pods”

Open up Docker ports in UFW

My home Docker installation had some ports blocked internally for a project I was working on today. The sequence of commands listed below will allow the containers to communicate internally while still keeping open outgoing connection and not changing any incoming UFW rules.

sudo ufw allow in on docker0
sudo sed -i s/DEFAULT_FORWARD_POLICY=\"DROP\"/DEFAULT_FORWARD_POLICY=\"ACCEPT\"/ /etc/default/ufw
sudo ufw enable
sudo iptables -t nat -A POSTROUTING ! -o docker0 -s 172.17.0.0/16 -j MASQUERADE

Original source link: http://blog.lukebennett.com/2015/09/13/make-docker-play-nicely-with-ufw/

Increase swap size for your Raspberry Pi

I have a little low-end POC (proof of concept) I’m testing out at home before I bring it in to work. The POC requires my Raspberry Pi to run a couple of Docker containers which isn’t really a problem. However, I’m using a 1st-gen Pi that came out with only 512MB RAM total. By the time Docker itself was up and running, I had something on the order of 40-50MB of RAM left and another 99MB swap with the stock swap settings. Continue reading “Increase swap size for your Raspberry Pi”

Hack the planet…with tmux

SysadminJr: Ha, but seriously – been having issues with Grafana lately.

SysadminSr: Just bypass that and do some real-time monitoring at the sources.

SysadminJr: Open 20 different SSH tabs?

SysadminSr: tmux, son, tmux. Check out tmuxcheatsheet.com.

Expect – an interpretive language in Linux

Expect is used to tie together multiple scripts or statements for which shell scripting is not quite powerful enough. From the man page: “In general, Expect is useful for running any program which requires interaction between the program and the user. All that is necessary is that the interaction can be characterized programmatically. Expect can also give the user back control (without halting the program being controlled) if desired. Similarly, the user can return control to the script at any time.”

%d