kube-spawn

See https://github.com/kinvolk/kube-spawn/tree/v0.2.1

Fresh setup of cluster:

From this you can access the nodes by using sudo machinectl shell kubespawndefault0. In the machine you can use kubectl and other kubernetes commands.

build.sh

#!/bin/bash

echo "Make a choice between the following options:"
echo "  create a new installation: c"
echo "  start existing machines  : e"
echo "  stop existing machines   : s"
echo -n "Choice: "
read -n 1 mode
echo

set -xe

sudo setenforce 0

sudo modprobe nf_conntrack
sudo sh -c "echo 32768 > /sys/module/nf_conntrack/parameters/hashsize"

cd /home/vagrant/go/src/github.com/kinvolk/kube-spawn

go get -u github.com/containernetworking/plugins/plugins/...

DOCKERIZED=n make all

sudo machinectl show-image coreos || sudo machinectl pull-raw --verify=no https://alpha.release.core-os.net/amd64-usr/current/coreos_developer_container.bin.bz2 coreos

if [ "$mode" == "c" ]; then
  for machine in `machinectl list | grep kubespawn | awk "{ print \\$1 }"`; do
    sudo machinectl poweroff $machine
  done
  for machine in `machinectl list-images | grep kubespawn | awk "{ print \\$1 }"`; do
    sudo machinectl remove $machine
  done

  sudo GOPATH=/home/vagrant/go CNI_PATH=/home/vagrant/go/bin ./kube-spawn create --nodes=4
  sudo GOPATH=/home/vagrant/go CNI_PATH=/home/vagrant/go/bin ./kube-spawn start
fi

if [ "$mode" == "e" ]; then
  sudo GOPATH=/home/vagrant/go CNI_PATH=/home/vagrant/go/bin ./kube-spawn restart
fi

if [ "$mode" == "s" ]; then
  sudo GOPATH=/home/vagrant/go CNI_PATH=/home/vagrant/go/bin ./kube-spawn stop
fi

busybox-deployment.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: busybox
spec:
selector:
matchLabels:
demo: busybox
replicas: 5
template:
metadata:
labels:
demo: busybox
spec:
containers:
- name: busybox
image: busybox
command: [ "sh", "-c", "while true; do echo $(hostname) v1 > /data/index.html; sleep 60; done" ]