LoginSignup
7
7

More than 5 years have passed since last update.

Mac + Virtualbox + CoreOS + etcd2 + fleet の基本設定(1)

Last updated at Posted at 2015-09-21

Mac + Vagrant + CoreOS環境構築

CoreOSは軽量化されたOSでDockerでアプリケーションを管理できるよう特化されたOSです。
その中にetcd2のクラスタ管理、fleetでのsystemd+clusterのプロセス管理ができるようになっています。

本章ではまず基礎となるvirtualbox + coreosを使った仮想でのcoreosクラスタを構築していきます。

※今回Vagrantを利用しなかったことについて後述します。

環境

環境 hostname public ip
MacbookAir 4GB hostserver xxx.xxx.xxx.xxx
virtualbox1 guest os WEB 192.168.0.10
virtualbox2 guest os storage 192.168.0.20
virtualbox3 guest os DB 192.168.0.30

今回目指す構成 2部に分けます。。。

phase 1

discoveryチャネルを使用して、3台構成のクラスタを作成します

cluster01.png

phase 2

3台構成のクラスタ配下に、workerを立てます。
参考:https://coreos.com/os/docs/latest/cluster-architectures.html#production-cluster-with-central-services

cluster02.png

前提

※virtualbox 5
※brewが入っていること

virtualboxインストール

virtualbox5
brew install Caskroom/cask/virtualbox Caskroom/cask/virtualbox-extension-pack

Coreos VirtualBoxインストール

あらかじめ下記URLからcoreosのisoを取得

vitualbox雛形の作成

1.Virtualbox画面より名前とオペレーティングシステム記入

coreos01.png

2.メモリサイズを指定 1024MB以上でないとインストールができません。

coreos02.png

3.VirtualDiskの設定 ※今回はVDI 必ず固定サイズにしてください

core03.png

4.ネットワークの設定

coreos04.png

5.初回起動時の設定

初回起動時は下記の画面になっています。

coreos05.png

まだOSがインストールされていないので、coreユーザーにパスワードを設定します。

coreos
sudo passwd core
**
#外部から接続できるようにipアドレスも確認しておきます。
ip a

6.外部からターミナルで接続し、基礎設定を行う

coreos
#上記で確認したIPに接続
ssh core@192.168.0.10

vim cloud-config.yml
#cloud-config

ssh_authorized_keys:
- ssh-rsa #ここに自身の公開鍵

users:
- name: coreuser
  passwd: $1$9T2FM/JI$/n3HP4chMkV/vCkZRPgQo/ #hogeでパスワード設定
  groups:
  - sudo
  - docker
  ssh-authorized-keys:
  - ssh-rsa #ここに自身の公開鍵

#上記記入後、以下のインストールコマンド実施

sudo coreos-install -d /dev/sda -C stable -c ~/cloud-config.yml
Checking availability of "local-file"
Fetching user-data from datasource of type "local-file"
Downloading the signature for http://stable.release.core-os.net/amd64-usr/766.3.0/coreos_production_image.bin.bz2...
2015-09-21 08:50:35 URL:http://stable.release.core-os.net/amd64-usr/766.3.0/coreos_production_image.bin.bz2.sig [543/543] -> "/tmp/coreos-install.uBCVFdM2DQ/coreos_production_image.bin.bz2.sig" [1]
Downloading, writing and verifying coreos_production_image.bin.bz2...
〜〜〜
Success! CoreOS stable 766.3.0 is installed on /dev/sda

#上記Success!がでて来ればOKです

今回は手動でVirtualboxにCoreOSの設定を仕込んで行きました。
このテンプレートをコピーして次回は、etcd2+fleetのクラスタ設定を行いたいと思います。

次項

Mac + Virtualbox + CoreOS + etcd2 + fleet の基本設定(2)

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7