Skip to content

Instantly share code, notes, and snippets.

@jbeda
jbeda / gke-kubecfg.sh
Last active August 29, 2015 14:08
Use kubecfg against GKE cluster
#!/bin/bash
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@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@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 / pick_number.py
Created December 5, 2012 18:21
Pick a winner out of a hat
import sys
import random
# Pick the number
magic = random.randint(0, 99)
print "Magic number is %d" % magic
candidates = sys.argv[1:]
for candidate in candidates:
@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 / manifest-template.yaml
Created October 23, 2014 22:28
Script to create VM to host private docker registry on GCE backed by GCS
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@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)

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 / gist:60db714598f6c6a7a0558086e2225ab4
Last active March 5, 2017 19:25
Install old docker on Ubuntu Xenial
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo sh -c "echo 'deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main' > /etc/apt/sources.list.d/docker.list"
sudo apt-get install docker-engine=1.12.6-0~ubuntu-xenial
sudo apt-mark hold docker-engine
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: flannel
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: flannel