Skip to content

Instantly share code, notes, and snippets.

We assume we have a set of master nodes (master-{1..N}) and a set of worker nodes (worker-{1..M}). We also assume that the container runtime (Docker, rkt) is already installed. For now, also assume that networking is configured. In my mind it is an open issue how much networking should be driven by kubernetes.

workstation$ ssh master-1

Start the kubelet. Here we just start it directly in the background for simplicity.

@jbeda
jbeda / describe-self.sh
Last active May 30, 2016 19:29
Describe GCE instance from within instance
gcloud compute instances describe \
--zone $(/usr/share/google/get_metadata_value zone | cut -d / -f 4) \
$(/usr/share/google/get_metadata_value hostname | cut -d . -f 1)
@jbeda
jbeda / gist:aadf3c144fbe2ad30f2d
Created February 20, 2016 05:21
Rethinking graphviz
NB: This is a stream of consciousness after a minimum of thought. It is possible that the graphviz community has already been over all of this. Please don't take this too seriously.
Graphviz is awesome. It allows you to logically describe a graph and then lay it out.
Graphviz is one of the most frustrating pieces of software I've ever used. It is easy to get everything you *want* in the diagram but increadibly hard to make it actually look the way you imagine it.
The fundamental problem, in my mind, is that there is an unfortunate incosistency around subgraphs. Most of the layout algorithms tend to do global layout when complex diagrams often times require different layout algorithms for different parts of the project.
To fix this I'd do the following:
* Allow true subgraph layout of nodes and edges completely contained in the subgraph. Allow users to easily mix and match layout algorithms in the same diagram.
@jbeda
jbeda / gist:43f0c3f31b8e53174fb4
Created October 21, 2015 20:16
Generic nginx config for many sites
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log debug;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@jbeda
jbeda / hello.xml
Created September 29, 2015 22:46
Minimal OOXML file
<?xml version="1.0" encoding="utf-8"?>
<?mso-application progid="Word.Document"?>
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
<pkg:part pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:name="/_rels/.rels" pkg:padding="512">
<pkg:xmlData>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Target="word/document.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"/>
</Relationships>
</pkg:xmlData>
</pkg:part>
@jbeda
jbeda / nar-spec.md
Created September 1, 2015 23:04
Nix Archive (NAR) file specification

This is taken directly from Figure 5.2 in http://nixos.org/~eelco/pubs/phd-thesis.pdf. It is presented here to be more directly linkable.

serialise(fso) = str("nix-archive-1") + serialise1(fso)

serialise1(fso) = str("(") + seralise2(fso) + str(")")

serialise2(type=Regular, exec, contents) =
  str("type") + str("regular")
 + (
[jbeda@web:/tmp/foo]$ mkdir -p reala/a
[jbeda@web:/tmp/foo]$ mkdir -p realb/b
[jbeda@web:/tmp/foo]$ mkdir virtual
[jbeda@web:/tmp/foo]$ ln -s v^Ctual ../
[jbeda@web:/tmp/foo]$ cd virtual/
[jbeda@web:/tmp/foo/virtual]$ ln -s ../reala/a a
[jbeda@web:/tmp/foo/virtual]$ ln -s ../realb/b b
[jbeda@web:/tmp/foo/virtual]$ cd a
[jbeda@web:/tmp/foo/virtual/a]$ pwd
/tmp/foo/virtual/a
@jbeda
jbeda / gist:4ab372c41a324c4988c8
Last active August 29, 2015 14:14
keybase.md
### Keybase proof
I hereby claim:
* I am jbeda on github.
* I am jbeda (https://keybase.io/jbeda) on keybase.
* I have a public key whose fingerprint is 5C24 BBED 521C DD97 489D 6490 01AD FF89 FA0B 63B6
To claim this, I am signing this object:
@jbeda
jbeda / gist:2cae7dd22a453c3caa94
Last active November 7, 2020 18:26
URLs for kubernetes release artifacts
$ gsutil ls -R gs://kubernetes-release/release/v0.5.4 | sed 's|gs://kubernetes-release|https://storage.googleapis.com/kubernetes-release|; /^.*:$/d; /^$/d'
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-client-darwin-386.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-client-darwin-amd64.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-client-linux-386.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-client-linux-amd64.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-client-linux-arm.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-salt.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes-server-linux-amd64.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/kubernetes.tar.gz
https://storage.googleapis.com/kubernetes-release/release/v0.5.4/bin/darwin/386/kubecfg
@jbeda
jbeda / gist:16191ad2cec4835de40b
Last active November 4, 2024 08:46
IP CIDR math in bash
function increment_ipv4 {
local ip_base=$1
local incr_amount=$2
local -a ip_components
local ip_regex="([0-9]+).([0-9]+).([0-9]+).([0-9]+)"
[[ $ip_base =~ $ip_regex ]]
ip_components=("${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" "${BASH_REMATCH[3]}" "${BASH_REMATCH[4]}")
ip_dec=0
local comp
for comp in "${ip_components[@]}"; do