- https://coreos.com/blog/running-kubernetes-example-on-CoreOS-part-2/
- https://github.com/GoogleCloudPlatform/kubernetes/blob/master/examples/guestbook/README.md
- https://coreos.com/blog/introducing-rudder/
- https://github.com/coreos/flannel
$ git clone https://gist.github.com/6177b69f1754f0590dbe.git
$ vagrant up
It will boot up one for etcd discovery
, one master
and two minion servers (minion-x
).
Setup an SSH tunnel to the Kubernetes API Server in order to use kubecfg
on your local machine.
$ curl -OL http://storage.googleapis.com/kubernetes/darwin/kubecfg
$ chmod +x kubecfg
$ mv kubecfg /usr/local/bin
$ kubecfg --version
Kubernetes v0.2-dev
$ vagrant ssh-config master > ssh.config
$ ssh -f -nNT -L 8080:127.0.0.1:8080 -F ssh.config master
$ kubecfg list pods
ID Image(s) Host Labels Status
---------- ---------- ---------- ---------- ----------
Cf.) https://github.com/kelseyhightower/kubernetes-coreos#running-commands-remotely
$ kubecfg -c redis-master.json create pods
I0919 21:28:53.758488 29403 request.go:292] Waiting for completion of /operations/1
ID Image(s) Host Labels Status
---------- ---------- ---------- ---------- ----------
redis-master-2 dockerfile/redis / name=redis-master Waiting
$ kubecfg list pods
ID Image(s) Host Labels Status
---------- ---------- ---------- ---------- ----------
redis-master-2 dockerfile/redis 192.168.12.11/ name=redis-master Waiting
$ kubecfg list pods
ID Image(s) Host Labels Status
---------- ---------- ---------- ---------- ----------
redis-master-2 dockerfile/redis 192.168.12.11/ name=redis-master Running
$ kubecfg -c redis-master-service.json create services
ID Labels Selector Port
---------- ---------- ---------- ----------
redismaster name=redis-master 10000
$ kubecfg list services
ID Labels Selector Port
---------- ---------- ---------- ----------
redismaster name=redis-master 10000
$ kubecfg -c redis-slave-controller.json create replicationControllers
I0919 21:35:28.725306 29856 request.go:292] Waiting for completion of /operations/4
ID Image(s) Selector Replicas
---------- ---------- ---------- ----------
redisSlaveController brendanburns/redis-slave name=redisslave 2
$ kubecfg list pods
ID Image(s) Host Labels Status
---------- ---------- ---------- ---------- ----------
redis-master-2 dockerfile/redis 192.168.12.11/ name=redis-master Running
8c46c480-407f-11e4-a8ea-0800271cb107 brendanburns/redis-slave 192.168.12.12/ name=redisslave,replicationController=redisSlaveController Waiting
8c472246-407f-11e4-a8ea-0800271cb107 brendanburns/redis-slave 192.168.12.11/ name=redisslave,replicationController=redisSlaveController Waiting
$ kubecfg list pods
ID Image(s) Host Labels Status
---------- ---------- ---------- ---------- ----------
8c472246-407f-11e4-a8ea-0800271cb107 brendanburns/redis-slave 192.168.12.11/ name=redisslave,replicationController=redisSlaveController Running
redis-master-2 dockerfile/redis 192.168.12.11/ name=redis-master Running
8c46c480-407f-11e4-a8ea-0800271cb107 brendanburns/redis-slave 192.168.12.12/ name=redisslave,replicationController=redisSlaveController Running
$ kubecfg -c redis-slave-service.json create services
I0919 21:46:52.782728 30375 request.go:292] Waiting for completion of /operations/9
ID Labels Selector Port
---------- ---------- ---------- ----------
redisslave name=redisslave name=redisslave 10001
$ kubecfg list services
ID Labels Selector Port
---------- ---------- ---------- ----------
redismaster name=redis-master 10000
redisslave name=redisslave name=redisslave 10001
$ kubecfg -c frontend-controller.json create replicationControllers
I0919 21:47:38.445604 30429 request.go:292] Waiting for completion of /operations/10
ID Image(s) Selector Replicas
---------- ---------- ---------- ----------
frontendController brendanburns/php-redis name=frontend 2
$ kubecfg list pods
ID Image(s) Host Labels Status
---------- ---------- ---------- ---------- ----------
8c46c480-407f-11e4-a8ea-0800271cb107 brendanburns/redis-slave 192.168.12.12/ name=redisslave,replicationController=redisSlaveController Running
8c472246-407f-11e4-a8ea-0800271cb107 brendanburns/redis-slave 192.168.12.11/ name=redisslave,replicationController=redisSlaveController Running
3f3fc79a-4081-11e4-a8ea-0800271cb107 brendanburns/php-redis 192.168.12.12/ name=frontend,replicationController=frontendController Waiting
3f3ff5ff-4081-11e4-a8ea-0800271cb107 brendanburns/php-redis 192.168.12.11/ name=frontend,replicationController=frontendController Waiting
redis-master-2 dockerfile/redis 192.168.12.11/ name=redis-master Running
$ kubecfg list pods
ID Image(s) Host Labels Status
---------- ---------- ---------- ---------- ----------
redis-master-2 dockerfile/redis 192.168.12.11/ name=redis-master Running
8c46c480-407f-11e4-a8ea-0800271cb107 brendanburns/redis-slave 192.168.12.12/ name=redisslave,replicationController=redisSlaveController Running
8c472246-407f-11e4-a8ea-0800271cb107 brendanburns/redis-slave 192.168.12.11/ name=redisslave,replicationController=redisSlaveController Running
3f3fc79a-4081-11e4-a8ea-0800271cb107 brendanburns/php-redis 192.168.12.12/ name=frontend,replicationController=frontendController Running
3f3ff5ff-4081-11e4-a8ea-0800271cb107 brendanburns/php-redis 192.168.12.11/ name=frontend,replicationController=frontendController Running
$ open http://192.168.12.11:8000
$ open http://192.168.12.12:8000
日本語補足
Running Kubernetes Example on CoreOS, Part 2 - Qiita
http://qiita.com/yungsang/items/f286154be7bb6c4ef09f