Last active
January 21, 2016 15:03
-
-
Save yamamoto-febc/5d28c8476cfeb117e2ff to your computer and use it in GitHub Desktop.
[実践編]docker + さくらのクラウドでマルチホストなoverlayネットワークしてみるよ(準備編) ref: http://qiita.com/yamamoto-febc/items/861afa1ce363f4161113
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker-machine create -d sakuracloud \ | |
--sakuracloud-access-token [アクセストークン] \ | |
--sakuracloud-access-token-secret [トークンシークレット] \ | |
--sakuracloud-connected-switch [さくらのクラウドで作成したスイッチのID] \ | |
--sakuracloud-private-ip [追加NICのIPアドレス] \ | |
--sakuracloud-private-ip-subnet-mask [追加NICのサブネットマスク] \ | |
sakura-dev | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# コマンド入力補助用の環境変数設定 | |
$ export SAKURACLOUD_ACCESS_TOKEN=[さくらのクラウドのアクセストークン] | |
$ export SAKURACLOUD_ACCESS_TOKEN_SECRET=[さくらのクラウドのトークンシークレット] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 石狩第1リージョンにKVS用のマシン構築 | |
$ docker-machine create -d sakuracloud \ | |
--sakuracloud-connected-switch [手順1で控えたスイッチのID] \ | |
--sakuracloud-additional-ip 192.168.11.101 \ | |
--sakuracloud-additional-subnet-mask 255.255.255.0 \ | |
sakura-is1a-kvs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dockerで作成したマシンを使うように設定 | |
$ eval "$(docker-machine env sakura-is1a-kvs)" | |
# consul起動 | |
$ docker run -d -p "192.168.11.101:8500:8500" -h "consul" progrium/consul -server -bootstrap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker-machine create -d sakuracloud \ | |
--swarm \ | |
--swarm-master \ | |
--swarm-discovery consul://192.168.11.101:8500 \ | |
--engine-opt="cluster-store=consul://192.168.11.101:8500" \ | |
--engine-opt="cluster-advertise=eth1:2376" \ | |
--sakuracloud-connected-switch [手順1で控えたスイッチのID] \ | |
--sakuracloud-private-ip 192.168.11.151 \ | |
--sakuracloud-private-ip-subnet-mask 255.255.255.0 \ | |
sakura-is1a-manager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 石狩第1リージョン | |
$ docker-machine create -d sakuracloud \ | |
--swarm \ | |
--swarm-discovery consul://192.168.11.101:8500 \ | |
--engine-opt="cluster-store=consul://192.168.11.101:8500" \ | |
--engine-opt="cluster-advertise=eth1:2376" \ | |
--sakuracloud-connected-switch [手順1で控えたスイッチのID] \ | |
--sakuracloud-private-ip 192.168.11.201 \ | |
--sakuracloud-private-ip-subnet-mask 255.255.255.0 \ | |
--sakuracloud-region is1a \ | |
sakura-is1a-agent | |
# 石狩第2リージョン | |
$ docker-machine create -d sakuracloud \ | |
--swarm \ | |
--swarm-discovery consul://192.168.11.101:8500 \ | |
--engine-opt="cluster-store=consul://192.168.11.101:8500" \ | |
--engine-opt="cluster-advertise=eth1:2376" \ | |
--sakuracloud-connected-switch [手順1で控えたスイッチのID] \ | |
--sakuracloud-private-ip 192.168.11.202 \ | |
--sakuracloud-private-ip-subnet-mask 255.255.255.0 \ | |
--sakuracloud-region is1b \ | |
sakura-is1b-agent | |
# 東京第1リージョン | |
$ docker-machine create -d sakuracloud \ | |
--swarm \ | |
--swarm-discovery consul://192.168.11.101:8500 \ | |
--engine-opt="cluster-store=consul://192.168.11.101:8500" \ | |
--engine-opt="cluster-advertise=eth1:2376" \ | |
--sakuracloud-connected-switch [手順1で控えたスイッチのID] \ | |
--sakuracloud-private-ip 192.168.11.203 \ | |
--sakuracloud-private-ip-subnet-mask 255.255.255.0 \ | |
--sakuracloud-region tk1a \ | |
sakura-tk1a-agent | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker-machine ls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker-machine ssh sakura-tk1a-agent | |
$ ping 192.168.11.201 #東京から石狩へpingが届く |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment