A reading list for the larval stage sysadmin/SRE. This list is focused on the UNIX family of OSes, but PRs about other OSes are welcome.
So you've got your first sysadmin/sre job or internship. Congratulations, it's going to be an interesting ride.
git
is a version control Swiss army knife. A reliable versatile multipurpose revision control tool whose extraordinary flexibility makes it tricky to learn, let alone master.The Dev part of DevOps means you're going to inevitably end up writing some code. Here's a list of free programming books for many languages.
Here are some of the scripting languages you're most likely to see in your infrastructure, with links to some good references and tutorials.
The awk
family (awk
, gawk
, nawk
and I'm sure I've missed other implementations) of scripting languages is one of the oldest - the first version of awk
was written in 1977, but it's on pretty much any unix (even minimal variants that might not have perl
, python
or ruby
) and is still very useful.
I still use it frequently for pulling columns out of tabular output because by default (and unlike cut
where you have to count spaces) it treats consecutive runs of whitespace characters as a delimiter, so for example you can pipe things to awk '{print $3}'
, but it's Turing-complete - people can and have written complex programs in it.
Here are some good references to get you started:
bash
is objectively a terrible programming language. All variables default to being globals, there is no module system built into the language, dealing with hashes is horrible, and there are other horrors resulting from it trying to be backward compatible with sh
.
That said, it is on every system, so every *NIX sysadmin needs to know bash
.
Here are some useful resources to help you step up your shell scripting game:
bash
as CLI tutorial.bash
scripts. It is targeted at beginning users with no advanced knowledge.bash
.bash
oneliners for almost every task you may need to accomplish.bash
scripts.bash
alternatives to external processes.bash
. It'll help you find unused variables, deprecated syntax and other things that make your bash
scripts less stable. You can install it with apt-get
, brew
, cabal
, or yum
.Finally, remember that bash
is not sh
. If you're writing a script in bash
, and testing it with bash
, don't use #!/bin/sh
as the shebang. Firstly, because bash
behaves differently when called as sh
, and secondly, not all *NIX systems (and not even all linux distributions) use bash
as their /bin/sh
any more.
Often you'll find yourself in a Windows enviroment, like it or not. These resources might help you in those cases -
Python has much better support for string manipulation and system infrastructure than Bash. In addition, there is a rich library of modules supporting various tasks you can use in your scripts that are just a pip3 install
away.
A couple of places to go into as training are:
Ruby also has a rich ecosystem of gems you can use in your programs, and like Python, much better string and data structure manipulation than Bash.
If you're in a Ruby shop, you'll want these books:
Perl has a long history of being the system administrator's friend, bringing the best of bash
, sed
and awk
together. It is also suitable for building tools for the system administrator to utilise in their work.
AzureRm
module and provides a migration path from it.Quite simply, if you aren't using configuration management, you're doing it wrong.
You don't want to manually configure any servers - no matter how hard you try, they won't end up truly identical and having meat typing in commands takes far too long per server, doesn't scale, and the manual labor will discourage you from standing up new VMs for testing.
Treating your configuration as something described in text files allows you to treat it like code. You can do pull-requests, get your changes reviewed by your team, view the differences between your configuration at different times, and almost most-importantly, find out who changed the configuration, when, and if they wrote good commit messages, why.
There are several good options:
Containers package software and all its dependencies in a single package that can be run in isolation from other containers or applications running on the server, without the overhead of a full virtual machine.
Containerd is an industry-standard container runtime with an emphasis on simplicity, robustness and portability. It is available as a daemon for Linux and Windows, which can manage the complete container lifecycle of its host system: image transfer and storage, container execution and supervision, low-level storage and network attachments, etc.
Follow the installation instructions for your preferred platform (Currently, only Linux and Windows are directly supported) and start learning how to use Containerd:
On macOS, you can use Lima, which launches Linux virtual machines with automatic file sharing, port forwarding, and containerd installed. You can use the lima xbar plugin for a simple menubar application to control your Lima VMs.
Docker is a tool for running and managing containers. Containers are rapidly growing in popularity for local development (as an alternative to virtual machines), and can also run software in production with tools like Kubernetes or Amazon ECS.
Follow the installation instructions for your preferred platform:
Kubernetes is a portable open-source container orchestration system used to automate deployment, scaling, and management of containerized applications.
There are many good tutorials at kubernetes.io. I recommend you start with either the minikube walkthrough since it will get you a running test cluster quickly, or enable the kubernetes cluster option in Docker Desktop.
VMWare sponsors a free set of online Kubernetes courses at https://kube.academy/courses.
If you want to understand everything that is involved in getting a Kubernetes cluster up and running, Kubernetes the Hard Way by Kelsey Hightower is a must-read.
Have you ever wondered exactly what happens when you type something like kubectl run nginx --image=nginx --replicas=3
to make everything happen? What happens when K8s... is an in-depth guide that leads you through the full lifecycle of a request from the client to the kubelet
, linking off to the source code where necessary to illustrate what's going on.
krew
helps you discover plugins, install and manage them on your machine. It is similar to tools like apt
, dnf
or brew
. Today, over 70 kubectl
plugins are available on krew
.kubectx
command, which makes it easy to switch between clusters specified in your .kube/config
, and kubens
, which helps you switch between Kubernetes namespaces smoothly.There are several good projects for monitoring.
Infroduction To Baselines for Dashboards - It's easy to make monitoring dashboards that are a jumble of poorly presented information. This series of articles gives guidelines on making good dashboards.
Many of the tools you're going to use have JSON output options. Trying to parse JSON with grep
or awk
is a world of pain, fortunately there is jq, a lightweight JSON processor you can use to slice out useful bits of the output for use in scripts similarly to how you can use awk
or sed
on text files.
Inevitably you're going to find yourself in a situation where you have to look at logs to see what's going wrong with a service. When it's a multi-gigabyte logfile, that can be extremely painful.
Enter regexes and the grep
family of tools.
When you have a multi-gigabyte logfile, it's a lot less painful to look at just the entries generated by the service that you got alerted about. Even better to only look at the error messages from the service, and something as basic as grep -i yourservice < log | grep -i errorcode
can convert a potentially multi-hour ordeal into a quick minute or two task.
^A.{0,3}BC$
.Serverless doesn't mean no sysadmins, even though there aren't instances to administer. We need to change common processes that we rely on to monitor and manage services that run on serverless platforms. There are not system level metrics to understand how our application is working.
Here are a few resources to help:
No matter what source control system you use (git
, hg
, perforce
, whatever), you're going to have to write commit messages. Make them good. It may be obvious today why you made the change, but in six months or a year you won't have that context.
Good commit messages help the rest of your team understand what you're trying to do and make it easier for them to find logic errors in your pull requests - the code may be technically correct, but if they understand what you're trying to do, they can see when your code isn't actually doing what you say you want it to do, even when it is syntactically correct.
Here are a few articles that while focused on git
commit messages apply to any source control system:
Whether or not your shop uses git
internally, you're going to end up needing to use it for the many useful things on GitHub and GitLab.
git
helper scripts.git
in specific situations.git
tipsgit
.git
.git
(particularly with GitHub).ssh
apps, libraries and other resources.Testing is incredibly important and you should undertake this for your infrastructure as well as your applications.
Don't get involved in the Editor Wars. Just. Don't. Your choice of tool does not need defending. Nor does anyone else's choice.
However, you should care about your tools. You should be able to use them efficiently.
vim
is a reality of life for SysAdmins. It is the one editor you can be sure is installed in even the most minimal *NIX or linux install. You must be able to do at least basic edits with it. You don't need to love it, but you will have to use it.
Emacs is an extremely extensible editor. In jest, it is frequently referred to as an operating system with a half-decent editor.
If you want to get a taste of what emacs
can do, you can defer to Magnars and his excellent video tutorials/demos:
One of the biggest problems with emacs
is that the defaults present a fairly different experience to what people are used to in other editors. Your first stop should be learning the basics using the built-in tutorial, followed by the mini-manual from tuhdo:
-Type ctrl-h
, followed closely by t
from within emacs
to see the tutorial http://tuhdo.github.io/index.html
Emacs can be can be made to look and act relatively modern if that's your desire:
If you're looking for emacs
packages, the following online package index is the most popular, and tracks many:
There are several excellent starter kits out there, with varying delineations of wizz-bang. Here are some starter kits, with spacemacs being the most popular:
Here are some emacs
configurations for inspiration:
emacs
config! magnars/.emacs.d
Use tools with which you are productive. If you want to use a GUI Text Editor or IDE, don't let anyone give you a hard time about that.
There are GUI versions of vim
and emacs
that have ardent followers.
Help wanted here.
Packetlife has some great cheat sheets and posters here for a lot of applications (wireshark
and tcpdump
for example) and networking principles. Well worth a look, even if you think you know the apps in question.
top
/htop
output here.Writing good documentation and design docs is as important as writing code. The more senior you are, the more writing you're going to have to do - communication skills are a must.
This repository is copyright 2017-2021 Joseph Block under a Attribution-NonCommercial-ShareAlike 4.0 International license.