Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
20180126 M3 TechTalk OpenFaaSお試し
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
tshohe
January 26, 2018
Technology
96
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
20180126 M3 TechTalk OpenFaaSお試し
tshohe
January 26, 2018
More Decks by tshohe
See All by tshohe
20190712 M3 TechTalk キーキャップ作る話
tshohe
0
1.5k
SRE Lounge #9 エムスリーはどのようにしてSREを始めたか
tshohe
11
19k
Other Decks in Technology
See All in Technology
ソフトウェアアーキテクチャ研修【MIXI 26新卒技術研修】
mixi_engineers
PRO
2
890
数値で見る Microsoft MVP 〜Spec Kit と GitHub Copilot Agent で作るデータ可視化ダッシュボード〜
yutakaosada
0
160
全社でのソフトウェアサプライチェーン攻撃対策をやってみた with Takumi Guard
z63d
0
320
最高のシステムプロンプトを作るためにフィードバック機能を導入した話
alchemy1115
0
170
reFACToring
moznion
1
820
SRENEXT_2026_Chairs__Talks_in_Tamachi.sre.pdf
srenext
1
160
Webの技術とガジェットで子どもも大人も楽しめるワクワク体験を提供する / Qiita Tech Festa Day 2026
you
PRO
1
310
論語・武士道・産業革命から見る かわるもの、かわらないもの
ichimichi
8
1.5k
AI時代におけるテストの基礎の再定義 / Rethinking the Fundamentals of Testing in the AI Era
mineo_matsuya
15
6k
AI Native なプロダクト組織の立ち上げ方 : 生産性 100 倍への挑戦
mikesorae
0
1.7k
ウォーターフォール開発案件のPMとしてAI活用を模索している話
hatahata021
2
140
ここは地獄!つらい朝会を体験することで、チームとしてのより良い振る舞いに気づくワークショップ / The stand-up meeting from hell in the game industry
scrummasudar
0
400
Featured
See All Featured
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
The Curse of the Amulet
leimatthew05
2
13k
How to Think Like a Performance Engineer
csswizardry
28
2.7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Automating Front-end Workflow
addyosmani
1370
210k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
330
How to Talk to Developers About Accessibility
jct
2
450
Crafting Experiences
bethany
1
230
The Invisible Side of Design
smashingmag
301
52k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
510
Transcript
OpenFaaS Λࢼͯ͠Έͨ Shohei Takahashi
Who am I? • ߴڮ উฏʢ͔ͨ͠ ͠ΐ͏͍ʣ • 2017/11݄ೖࣾ •
ΠϯϑϥνʔϜॴଐͷSREͱͯ͠ಇ͍ͯ·͢ɻ • ٕज़ɿJava (Spring Boot), Python (Django), PostgreSQLɺ Elastic StackʢElasticsearch, Logstash, Kibanaʣ • झຯɿRaspberry Pi ༡ͼ
͜Ε·Ͱ • ϞϊϦγοΫͳΞϓϦ͔͠ॻ͍ͯͳ͍… • ӡ༻͢͠͞ͱ͔ಛʹҙࣝͯ͠ͳ͍… • ͳΜ͔ͦΕͬΆ͍͜ͱ͍ͨ͠
ڥ • ίʔυ͚ͩॻ͚͋ͱ͍͍ײ͡Ͱಈ͍ͯ͘ΕΔ • मਖ਼͕༰қɺଈ࠲ʹөՄೳ • ΠϯϑϥΛ͋·Γҙࣝ͠ͳͯ͘ྑ͍ • ӡ༻ଆཧָ͕ •
ͱ͔ʁ
OpenFaaS • ίϯςφܕαʔόϨεϑϨʔϜϫʔΫ • Docker/Swarm/Kubernetes⎈্ͰFaaSڥΛߏஙͰ͖ Δͭ • MITϥΠηϯε • ΫϥυαʔϏεͱҟͳΓॾʑͷ੍ݶͳ͠
• Auto-Sacle Մೳ
ಋೖ • KubernetesΛόοΫΤϯυͱͯ͠͏ͨΊͷϓϥάΠϯfaas-netes͕͋Δ • helmͰೖΔΒ͍͠ʢෆ۩߹͕͋ͬͨͷͰkubectlͰʣ • OpenFaaS on Kubernetes on
Rancher $ curl -LO https://github.com/openfaas/faas- netes/archive/master.zip $ unzip master.zip $ cd faas-netes-master $ kubectl apply -f ./namespaces.yml $ kubectl apply -f ./yaml
http://[kubernetes host]:31112/ui/
ྲྀΕ 1. function هࡌ 2. function Λ Docker image ͱͯ͠Ϗϧυ
3. Docker Registry ʹ push 4. function Λ deploy
function هࡌ • GUIͰ͍͍͚Ͳɺcliπʔϧ͕͋ΔͷͰͦΕΛ͏ʢbrewͰೖΔʣ • ্هίϚϯυͰԼهͷΑ͏ͳܗ͕࡞͞ΕΔ ʢݴޠPythonΛબɺ͍Ζ͍Ζબ·͢ʣ • template ……
֤ݴޠ༻ͷDockerfileʢgo, node.js, ruby, python, C#ʣ • ໊ؔσΟϨΫτϦ • handler.py ……. ࣮ࡍͷؔΛهࡌ͢Δɻ • requirement.txt …… ͍͍ͨύοέʔδ͕͋Ε • ໊ؔ.yml …… gateway, language, docker image nameઃఆ $ faas-cli new --lang python test-function $ ls template test-function test-function.yml
function هࡌ • stdinΛड͚औͬͯstdoutΛ݁Ռͱͯ͠ฦ͢functionΛهࡌ • ͻͱ·ͣ͠ࢉؔΛ࡞ $ vi test-function/handler.py import
json def handle(req): json_req = json.loads(req) answer = int(json_req["a"]) + int(json_req["b"]) result = {"answer": answer} print(json.dumps(result))
function Ϗϧυ • [Local Docker Registry]:5000/tshohe/test-function: 0.0.1 ͱͯ͠Ϗϧυ • ϩʔΧϧͰςετͱ͔Ͱ͖Δ
• ϕʔεͷpython 2.7-alpine͕Ͱ͔͍ͷͰɺ݁ߏͰ͔͍ $ faas-cli build -f ./test-function.yml $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE [Local Docker Registry]:5000/tshohe/test-function 0.0.1 ae45b01bb0bb 34 seconds ago 81.1MB
function deploy & ࣮ߦ • ͠ࢉ͕࣮ߦͰ͖ͯΔ • -> API Gateway
<-> Watchdog <-> Function $ faas-cli push -f ./test-function.yml $ faas-cli deploy -f ./test-function.yml $ curl [kubernetes host]:31112/function/test-function -d '{"a":1,"b": 2}' {"answer": 3}
• tagΛ0.0.2ʹͯ͠build & push & deploy • өʂ function मਖ਼
- answer = int(json_req["a"]) + int(json_req["b"]) + answer = int(json_req["a"]) * int(json_req[“b”]) $ curl [kubernetes host]:31112/function/test-function -d '{"a":1,"b":2}' {"answer": 2} • function Λमਖ਼ • tagΛࢦఆͯ͠͠deploy͢Ε͙ͤ͢Δ
function ࣮ߦ࣌ؒՄࢹԽ • Grafanaʹ༗ࢤ͕࡞ͨ͠μογϡϘʔυ͕͋Δ༷ • ҰॹʹPrometheusೖΔͷͰͦ͜Λσʔλιʔεʹࢦఆ͢Δ͚ͩ • AlertManagerσϑΥϧτͰઃఆ͞Ε͍ͯͨΓ͢Δʢ͔ͨ͠ෛՙ্ঢ࣌ɺίϯςφࣦؕ࣌ʣ
·ͱΊ • ׂΓͱ؆୯ʹࢼָͤͯ͛͠ • Ͳ͏αʔϏεΛߏஙͰ͖Δ͔ະ • ΠϕϯτΛݕ࣮ͯ͠ߦͰ͖Δͷ͔ɺͱ͔ • શମ૾ͷཧେมͦ͏ •
function ຖʹόʔδϣϯཧͱ͔ࠞཚͦ͠͏ • Auto-scaleɺFunction Chain ͱ͔ࢼͯ͠Έ͍ͨ
ͦͷଞ function • StoreͳΔͱ͜Ζʹ୭͔͕࡞͕ͬͨؔஔ͍ͯ͋ͬͨΓ