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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
tshohe
January 26, 2018
Technology
94
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
いまさら聞けない「仕様駆動開発入門」 〜AI活用時代の開発プロセスを考える〜
findy_eventslides
2
230
Microsoft のサポートとフィードバック総まとめ
murachiakira
PRO
0
120
5分でわかる Amazon Connect_20260608
hwangbyeonghun
0
130
AIエージェントとPhysical AIが拓く製造業の変革(ハノーバーメッセリキャップ)
iotcomjpadmin
0
170
MySQL & MySQL HeatWave Report - June 2026
freshdaz
0
200
徹底討論!ECS vs EKS!
daitak
3
1.8k
トークン最適化のためのユーザーストーリー分析 / User Story Analysis for Token Optimization
oomatomo
0
130
技術・能力を向上する原理原則 #きのこセッションa #きのこ2026
bash0c7
0
160
2026 AI Memory Architecture
nagatsu
0
590
攻撃者がいなくてもAIエージェントはインシデントを起こす
nomizone
0
150
Lightning近況報告
kozy4324
0
230
AWS Summit の片隅で、体育座りしながらコミュニティがにぎわう理由を考えた
k_adachi_01
2
270
Featured
See All Featured
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
170
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
440
A Soul's Torment
seathinner
6
3k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
240
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
260
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
Designing for Performance
lara
611
70k
Thoughts on Productivity
jonyablonski
76
5.2k
Un-Boring Meetings
codingconduct
0
320
Are puppies a ranking factor?
jonoalderson
1
3.7k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
740
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
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ͳΔͱ͜Ζʹ୭͔͕࡞͕ͬͨؔஔ͍ͯ͋ͬͨΓ