Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block mowings

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mowings /
Last active Sep 29, 2019
Getting lxc 2.x running on ubuntu 18

I won't lie -- it's ugly

Go grab the latest 2x source release from github. Be sure you have automake and libcap-dev installed before starting. Be sure you fully delete and 3x stuff if you installed it. This includes shared libraries.

Follow the instructions for building and installing. The catch, here, is that everything is going to be installed and run under /usr/local. You may need to run ldconfig after installation to pick up the shared lib directorues, and many programs that automate lxc operations will not be expecting stuff to be installed under /usr/local.

In particular, what used to be /var/lib/lxc will now be under /usr/local/var/lib/lxc, so you may need a symlink. We

mowings /
Last active Aug 30, 2019
kubernetes. kubectl top pod -- cannot find pod

The deployjent yaml typically does not work out of the box. Fix deploy/1.8+/metrics-server-deployment.yaml as follows:

      - name: metrics-server
        imagePullPolicy: Always
        - name: tmp-dir
          mountPath: /tmp
mowings /
Created Aug 15, 2019
Kubernetes install on ubuntu. Assumes docker is already installed
apt-get update && apt-get install -y apt-transport-https \
&& curl -s | apt-key add -
echo "deb kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
apt-get update \
&& apt-get install -y kubelet kubeadm kubernetes-cni
View websocket.go
package main
import (
mowings / kubernetes
Last active Jun 30, 2019
kubernetes links
View kubernetes
mowings /
Last active Jun 28, 2019
Run cron on docker with job output directed to stdout

You'd like a docker container that runs cron jobs, with the output of those cron jobs going to stdout so they are accessible as docker logs. How do you do that?

Install cron, and set it up to run in the foreground

In your Dockerfile, apt-get -y install cron Use apk or whatever if you are running on alpine or another distribution Set the command or entrypoint in your Dockerfile to run cron 9n the foreground

ENTRYPOINT ["/usr/sbin/cron", "-f"]
mowings /
Last active Jun 30, 2019
Bash -- sleep until a specific time, like tomorrow midnight
# Sometimes you want to sleep until a specific time in a bash script. This is useful, for instance
# in a docker container that does a single thing at a specific time on a regular interval, but does not want to be bothered
# with cron or at. The -d option to date is VERY flexible for relative times.
# See
# For details
# ALPINE USERS: You will need to install coreutils, as the built-in busybox date does not handle -d correctly.
mowings / kubernetes
Last active Jun 26, 2019
Add a new kubernetes node to existing cluster
View kubernetes

Install the node software:

apt update && apt upgrade -y
curl | apt-key add -

cat <<EOF > /etc/apt/sources.list.d/kubernetes.list
deb kubernetes-xenial main

apt-get update
mowings /
Created Jun 24, 2019
Disable NCQ (disk command queuing in linux)

There is a kernel option to do this, if it cauxes boot issues, but otherwise in /etc/rc.local you can just add

echo 1 > /sys/block/sdb/device/queue_depth

Normally the kernel disables it after too many errors automatically, but it can cause disk timeouts until that happens. Does not have much of a performance impact on ssds.

mowings /
Last active Jun 20, 2019
Enable autoremove of old kernels from ubuntu /boot directory

edit /etc/apt/apt.conf.d/50unattended-upgrades

Uncomment line:

Unattended-Upgrade::Remove-Unused-Dependencies “false”;

and change to true

This all assumes unattended-upgrades is enabled (it usually is by default)

You can’t perform that action at this time.