Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
IoTっぽいアプリをk3s+Raspberry Piで実行する
Search
taiko19xx
April 26, 2019
Technology
370
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
IoTっぽいアプリをk3s+Raspberry Piで実行する
2019/04/26のCloud Native Sendai #1で発表した資料です
taiko19xx
April 26, 2019
More Decks by taiko19xx
See All by taiko19xx
Bedrockで遊ぼう! 短期間で色々開発してみた
taiko19xx
1
200
Incident Managerでインシデント発生時のエスカレーションを自動化する
taiko19xx
0
300
LambdaカスタムランタイムでPHPでもサーバーレス!
taiko19xx
0
100
ハニーポットから見たWebサーバへの攻撃
taiko19xx
0
3k
PHPなプロダクトをAmazon ECSで開発運用してる話
taiko19xx
0
1.4k
RaspberryPi+AWSでIoT(っぽ い)GPSロガーを作ってみた
taiko19xx
0
1.7k
PHPからWin32APIをいじってみた
taiko19xx
0
1.8k
Other Decks in Technology
See All in Technology
業務でAWSをあまり使っていない私が、AWSへのモチベを保つ方法
smt7174
0
180
Building Audio Plugin Ecosystem for Android in 2026
atsushieno
2
160
Kiro Crew の Bot (続く役目を任せる窓口) | 目指せ Kiro マスター 12
inariku
PRO
2
320
Reticulum, le réseau cypherpunk dont vous avez besoin !
rlifchitz
0
110
Content Mapper APIの応用例~CSS Modules、言語ファイル~
uhyo
2
620
サボる子はいねぇがー!AgentCoreハーネスの脆弱性に学ぶ、エージェントの入力バリデーション
iwamot
PRO
5
310
evcc & Home Assistant
naltatis
0
260
The Author Pays
hiccupps
0
130
Shared Signals Framework 仕様解説
oidfj
0
260
基本から分かる!AWSセキュリティ運用の考え方と任せ方
cmusudakeisuke
1
460
re:Invent2026 事前勉強会 歴史と愉しみ方10分LT編
toshi_atsumi
0
160
AIがGISを代替する日:〜すべてをAIが創る時代に、私たちがFOSS4Gに関わる意味〜
lehupa
1
210
Featured
See All Featured
Building Applications with DynamoDB
mza
96
7.3k
Are puppies a ranking factor?
jonoalderson
2
4.2k
Technical Leadership for Architectural Decision Making
baasie
3
640
Testing 201, or: Great Expectations
jmmastey
46
8.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Crafting Experiences
bethany
1
430
Chasing Engaging Ingredients in Design
codingconduct
0
390
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Practical Orchestrator
shlominoach
192
12k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Design in an AI World
tapps
1
390
Transcript
IoT”っぽい”アプリを k3s+Raspberry Piで実行する Cloud Native Sendai #01@2019/04/26 @taiko19xx / 木村
俊彦
自己紹介 • 木村俊彦(@taiko19xx) • 主にAzure/AWSの設計構築 • PHP/Node.jsでのバックエンド構築も • 技術系同人誌サークル「杜の都の開発室」主宰 •
https://morinomiyakono.booth.pm/ • 「技術書典」というイベントで本を出しています
None
いつものように Raspberry Piで遊んでいた ある日のこと…
ある日のこと • Raspberry PiでDockerは動く • Kubernetesは動くのか? • 実用的かは別 • 動いたとしてもRaspberry
Piには重荷と予想
None
None
ある日のこと • Kubernetesも思っていた以上の低負荷で動かせる事が判明 • コンテナ動かすだけであれば簡単にできる • せっかくなのでRaspberry Piらしい何かをしたい
“GPIO”にアクセスして “Lチカ”させられないか?
What is GPIO/Lチカ • GPIO = General-purpose input/output • 汎用入出力のこと
• Raspberry Piに沢山ついている”ピン” • Lチカ = LEDチカチカ • LEDを点滅させること • 電子工作の第一歩として有名
KubernetesのPodから 物理デバイスにアクセスする 必要がある
実現するための唯一にして 最大のハードル
本当に可能か?
今回の実験環境 • Raspberry Pi 3B • Raspbian Stretch • k3s
v0.4.0 • Kubernetes v1.14.1-k3s.4 • Docker v18.09.0 • 比較用 • k3sにcontainerdが含まれているので、Docker自体は不要
Docker単体ではどうか? • 可能 • $ docker run -it --rm --device
/dev/gpiomem raspbian/stretch /bin/bash • --device /dev/gpiomem でGPIOが割り当てられてるメモリ領域 へのアクセスを可能にする
None
None
しかしKubernetesには --device相当のオプションが ない
None
None
行けるかと思ったが ダメだった…
最終手段、Privileged • 特権モードを有効にしてホストのデバイスの操作ができる • https://kubernetes.io/docs/concepts/workloads/pods/pod/#priv ileged-mode-for-pod-containers • Kubernetesでは1.11以降でサポート • Dockerにもある(--privileged)
• 全デバイスにアクセスできるので諸刃の剣
None
Lチカのデモ
Kubernetes on Raspberry Piは 実用的か?
正直(まだ)実用的ではない
実用的ではない理由 • 利用できるコンテナが少ない • Raspberry PiはARM(armhf/arm64)アーキテクチャ • 既存のコンテナ(x86_64)が利用できない • 種類がない訳ではない
• カスタマイズする場合のビルドも大変 • Raspberry Pi(もしくは他のARMデバイス)上でビルドする • もしくはクロスプラットフォームビルドを行う必要がある • まだまだ重い • K3sを使えば大分軽くはなるが…
Kubernetesを使うことによる良い面 • 使い慣れたkubectlでデプロイや操作ができる • ビルド問題が解決できている前提 • 管理に利用するツールが一括で済む • SSHで接続してログやサービスの状態を確認する手間が減る •
Podが落ちても自動でリトライしてくれる • スタンドアロンで動作させる時は便利 • IoT機器は基本スタンドアロン
結論 • 何とか物理アクセスは可能 • 1GBしかメモリを積んでいない環境ではまだまだ重荷 • KubernetesやK3sのこれからに期待 • Raspberry Piのような制限のある環境で試行錯誤するのは楽しい
• 休み中のコンテナ入門にいかがでしょうか • 頑張ればクラスタも組めます
ありがとうございました