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 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)

mowings /
Last active May 14, 2019
Install Kubernetes at Digital Ocean using private networking

Install the software

Instructions mostly at but be sure to read the notes below before starting.

additional setup

This document assumes all hosts are on the private network, and the hosts are configured to pass/allow all traffic on that network. You could tighten this up if you want, but k8 requires quite a range of ports be open.

Be sure the --apiserver-advertise-address=<private ip> parameter is passed to kubeadm init on any master host. By default, the api-server will attempt to advertise on the public interface.

You can’t perform that action at this time.