Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
107 lines (68 sloc) 2.85 KB
boot2kubernetes
Docker Meetup Tokyo #5 (LT)
19 Aug 2015
deeeet
@deeeet
http://deeeet.com/
* About me
.image deeeet.png 200 _
- *@deeeet* (twitter) / *@tcnksm* (github)
- [[http://deeeet.com][http://deeeet.com]]
- PaaS engineer (Using CloudFoundry)
* TL;DR
Introduction of my recent project [[https://github.com/tcnksm/boot2kubernetes][tcnksm/boot2kubernetes]]
* Agenda
- What is boot2kubernetes?
- Why did you build this?
- Inside boot2kubernetes
- DEMO
* What is boot2kubernetes?
Run single node kubernetes cluster in *one* *command* using docker 🐳
$ boot2k8s up
Just this, it pulls required docker images and starts them.
If you run docker on boot2docker-vm, you need port forwarding for connecting api server via `kubectl`. `boot2k8s` automatically detects that and starts proxy server for you.
And easy to clean everything,
$ boot2k8s destroy
* Why did you build this?
Becasue kubernetes has reached the v1 milestone 🎉, it's good time to start!
It's important that:
- Anyone can try it more easily
- Anyone can build test environment more quickly
* Inside boot2kubernetes
boot2kubernetes is written by Go.
I experimentally use [[https://github.com/docker/libcompose][docker/libcompose]] (& [[https://github.com/jteeuwen/go-bindata][jtweeuwen/go-bindata]] ). `libcompose` is official golang implementation of docker-compose. We can also use it as library from our code.
* Inside boot2kubernetes (Comopose file)
etcd:
image: gcr.io/google_containers/etcd:2.0.9
net: host
command: /usr/local/bin/etcd --addr=127.0.0.1:4001 --bind-addr=0.0.0.0:4001 --data-dir=/var/etcd/data
master:
image: gcr.io/google_containers/hyperkube:v0.21.2
net: host
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: /hyperkube kubelet --api_servers=http://localhost:8080 --v=2 --address=0.0.0.0 --enable_server --hostname_override=127.0.0.1 --config=/etc/kubernetes/manifests
proxy:
image: gcr.io/google_containers/hyperkube:v0.21.2
net: host
privileged: true
command: /hyperkube proxy --master=http://127.0.0.1:8080 --v=2
[[https://github.com/kubernetes/kubernetes/blob/release-1.0/docs/getting-started-guides/docker.md][Running Kubernetes locally via Docker]]
* Inside boot2kubenetes (libcompose & go-bindata)
Convert compose file (`k8s.yml`) into managable Go source code by go-bindata,
$ go-bindata k8s.yml # this generates bindata.go
Read it and start containers by libcompose,
// Read compose file via bindata.go
compose, _ := config.Asset("k8s.yml")
// Setup new docker-compose project
context := &docker.Context{
Context: project.Context{
ComposeBytes: compose,
ProjectName: "boot2k8s",
},
}
project, _ := docker.NewProject(context)
project.Up() // Start kubernetes cluster 🙆
* DEMO
* Future
- Integrate with `docker-machine` (We can run k8s where we want)