LoginSignup
3
3

More than 5 years have passed since last update.

Raspberry Piでkubernetesクラスタを組んでみる①

Posted at

Raspberry PiへのOSのインストール

用意するもの

  • RaspberryPi3 ModelB × 3 (RaspberryPi2でもいけるらしい)
  • SDカード 16GB × 3(とにかく転送速度が速いものほどいい)
  • USB電源(microUSBで給電できるAndroidスマホの充電器とかでもいけるよ。3つ必要)

Raspberry Piに入れるOSイメージを用意する

Raspberry Pi用のOS、RaspbianにDockerを入れてやりました。
HypriotOSを使うと元からDockerga入っているし楽ちんとオライリーの入門kubernetesには書いてあったのですが、バージョンが違うのか本に書いている内容と違った動きをするので諦めました。(トラブルシュートする場合、HypriotOSよりRaspbianの方がいろんな記事がヒットするかなんとかなりそう)

OSイメージをSDカードに書き込んでみる。

https://www.raspberrypi.org/downloads/raspbian/
ここからイメージをDLしてくる

# UnZip
$ cd ~/Downloads
$ unzip 2018-06-27-raspbian-stretch-lite.zip

# ここでSDを差し込む
$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            199.5 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:       Microsoft Basic Data BOOTCAMP                50.7 GB    disk0s4

/dev/disk1 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *15.7 GB    disk1
   1:             Windows_FAT_32                         15.7 GB    disk1s1
# ↑SDはdisk1だ!
# unmountする
$ diskutil unmountdisk /dev/disk1
Unmount of all volumes on disk1 was successful

# 書き込み!(sudoつけるの忘れずに)
$ sudo dd if=2018-06-27-raspbian-stretch-lite.img of=/dev/rdisk1 bs=1m
Password:
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 123.390814 secs (8498007 bytes/sec)

# ssh有効化
$ cd /Volumes/boot
$ touch ssh

# cgroups有効化
$ vi cmdline.txt

cgroup_enable=cpuset cgroup_enable=memoryを追加

# ↑この作業を3回(SDカード3枚分)繰り返す

SDをRaspberry Piにセットして起動する

USBコードをさしたらもう起動されます。
この時、モニタ(HDMI)とキーボード(USB)も接続しておきましょう。
なにやらCUIの画面が出てくれば起動OKです。

注意事項

起動時にエラーやワーニングのメッセージが出てくるときは注意してください。
私の場合、SDの3枚中1枚が不良品だったようでそういった状況になってました。SD変えた途端、以降の作業も含めてちゃんと動くようになったのでSDの不良だったんだろうなあと。

3
3
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
3
3